diff --git a/.ci/pgsql_fixtures.sh b/.ci/pgsql_fixtures.sh deleted file mode 100644 index 2c872a3..0000000 --- a/.ci/pgsql_fixtures.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -echo "Configure PostgreSQL test database" - -psql -U postgres -c 'create database phpdb_test;' -psql -U postgres -c "alter role postgres password 'postgres'" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 289e5ff..53978b8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -33,7 +33,6 @@ jobs: postgres: image: postgres env: - POSTGRES_USER: 'gha' POSTGRES_PASSWORD: 'password' POSTGRES_DB: 'phpdb_test' options: >- @@ -42,4 +41,4 @@ jobs: --health-timeout 5s --health-retries 3 ports: - - 5432 \ No newline at end of file + - 5432 diff --git a/.laminas-ci/phpunit.xml b/.laminas-ci/phpunit.xml deleted file mode 100644 index af92d7b..0000000 --- a/.laminas-ci/phpunit.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - ./test/unit - - - ./test/integration - - - - - - - - - - - - diff --git a/.laminas-ci/pre-install.sh b/.laminas-ci/pre-install.sh deleted file mode 100644 index a3c153e..0000000 --- a/.laminas-ci/pre-install.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -WORKING_DIRECTORY=$2 -JOB=$3 -PHP_VERSION=$(echo "${JOB}" | jq -r '.php') - - -if [ ! -z "$GITHUB_BASE_REF" ] && [[ "$GITHUB_BASE_REF" =~ ^[0-9]+\.[0-9] ]]; then - readarray -td. TARGET_BRANCH_VERSION_PARTS <<<"${GITHUB_BASE_REF}."; - unset 'TARGET_BRANCH_VERSION_PARTS[-1]'; - declare -a TARGET_BRANCH_VERSION_PARTS - MAJOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[0]} - MINOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[1]} - - export COMPOSER_ROOT_VERISON="${MAJOR_OF_TARGET_BRANCH}.${MINOR_OF_TARGET_BRANCH}.99" - echo "Exported COMPOSER_ROOT_VERISON as ${COMPOSER_ROOT_VERISON}" -fi diff --git a/.laminas-ci/pre-run.sh b/.laminas-ci/pre-run.sh deleted file mode 100644 index 660082a..0000000 --- a/.laminas-ci/pre-run.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -TEST_USER=$1 -WORKSPACE=$2 -JOB=$3 - -COMMAND=$(echo "${JOB}" | jq -r '.command') - -if [[ ! ${COMMAND} =~ phpunit ]]; then - exit 0 -fi - -PHP_VERSION=$(echo "${JOB}" | jq -r '.php') - -# Install CI version of phpunit config -cp .laminas-ci/phpunit.xml phpunit.xml - -# Install lsof (used in integration tests) -apt update -qq -apt install -yqq lsof diff --git a/compose.yml b/compose.yml index 704f405..0c79e79 100644 --- a/compose.yml +++ b/compose.yml @@ -8,12 +8,12 @@ services: volumes: - ./:/var/www/html depends_on: - - postgresql + - postgres - postgresql: + postgres: build: context: ./ - dockerfile: docker/databases/postgresql/Dockerfile + dockerfile: docker/databases/postgres/Dockerfile args: - VERSION=${VERSION:-17.4} - ALPINE_VERSION=${ALPINE_VERSION:-3.21} @@ -30,4 +30,4 @@ services: interval: 30s timeout: 60s retries: 5 - start_period: 80s \ No newline at end of file + start_period: 80s diff --git a/composer.json b/composer.json index bcfaaa0..e97c8a7 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ }, "extra": { "laminas": { - "config-provider": "PhpDb\\Adapter\\Pgsql\\ConfigProvider" + "config-provider": "PhpDb\\Pgsql\\ConfigProvider" } }, "require": { @@ -48,14 +48,14 @@ }, "autoload": { "psr-4": { - "PhpDb\\Adapter\\Pgsql\\": "src/" + "PhpDb\\Pgsql\\": "src/" } }, "autoload-dev": { "psr-4": { - "PhpDbTest\\Adapter\\Pgsql\\": "test/unit/", + "PhpDbTest\\Pgsql\\": "test/unit/", "PhpDbTestAsset\\Pgsql\\": "test/asset/", - "PhpDbIntegrationTest\\Adapter\\Pgsql\\": "test/integration/" + "PhpDbIntegrationTest\\Pgsql\\": "test/integration/" } }, "scripts": { diff --git a/docker/databases/postgresql/Dockerfile b/docker/databases/postgres/Dockerfile similarity index 100% rename from docker/databases/postgresql/Dockerfile rename to docker/databases/postgres/Dockerfile diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0bdc0a7..469b9a9 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,11 @@ parameters: ignoreErrors: + - + message: '#^PHPDoc tag @throws with type PhpDb\\Adapter\\Exception\\InvalidConnectionParametersException\|PhpDb\\Adapter\\Pgsql\\Exception\\ContainerException is not subtype of Throwable$#' + identifier: throws.notThrowable + count: 1 + path: src/Container/ConnectionInterfaceFactory.php + - message: '#^Parameter \#2 \$array of function implode expects array\, array\\> given\.$#' identifier: argument.type diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 295633b..fd2555f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,6 +13,10 @@ failOnNotice="true" failOnDeprecation="true" failOnWarning="true"> + + + + ./test/unit @@ -29,10 +33,10 @@ - - - - - + + + + + - \ No newline at end of file + diff --git a/src/AdapterPlatform.php b/src/AdapterPlatform.php index 20d6c45..c245e41 100644 --- a/src/AdapterPlatform.php +++ b/src/AdapterPlatform.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql; +namespace PhpDb\Pgsql; use Override; use PDO; diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 3cc2eac..5af1c8c 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql; +namespace PhpDb\Pgsql; use PhpDb\Adapter\AdapterInterface; use PhpDb\Adapter\Driver\ConnectionInterface; @@ -10,11 +10,11 @@ use PhpDb\Adapter\Driver\Pdo\Statement as PdoStatement; use PhpDb\Adapter\Driver\PdoConnectionInterface; use PhpDb\Adapter\Driver\PdoDriverInterface; -use PhpDb\Adapter\Pgsql\Pdo\Connection as PdoConnection; -use PhpDb\Adapter\Pgsql\Pdo\Driver as PdoDriver; use PhpDb\Adapter\Platform\PlatformInterface; use PhpDb\ConfigProvider as PhpDbConfigProvider; use PhpDb\Metadata\MetadataInterface; +use PhpDb\Pgsql\Pdo\Connection as PdoConnection; +use PhpDb\Pgsql\Pdo\Driver as PdoDriver; /** * @internal diff --git a/src/Connection.php b/src/Connection.php index b3a3f14..0085a7b 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql; +namespace PhpDb\Pgsql; use Override; use PgSql\Connection as PgSqlConnection; diff --git a/src/Container/ConnectionInterfaceFactory.php b/src/Container/ConnectionInterfaceFactory.php index 28f17cc..70e3805 100644 --- a/src/Container/ConnectionInterfaceFactory.php +++ b/src/Container/ConnectionInterfaceFactory.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; use PhpDb\Adapter\Driver\ConnectionInterface; use PhpDb\Adapter\Exception\InvalidConnectionParametersException; -use PhpDb\Adapter\Pgsql\Connection; use PhpDb\Adapter\Pgsql\Exception\ContainerException; +use PhpDb\Pgsql\Connection; use Psr\Container\ContainerInterface; use function is_array; diff --git a/src/Container/DriverInterfaceFactory.php b/src/Container/DriverInterfaceFactory.php index 3b8c7e1..8156852 100644 --- a/src/Container/DriverInterfaceFactory.php +++ b/src/Container/DriverInterfaceFactory.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; use Laminas\ServiceManager\ServiceManager; use PhpDb\Adapter\Driver\DriverInterface; -use PhpDb\Adapter\Pgsql; use PhpDb\Exception\ContainerException; +use PhpDb\Pgsql; use Psr\Container\ContainerInterface; final class DriverInterfaceFactory diff --git a/src/Container/MetadataInterfaceFactory.php b/src/Container/MetadataInterfaceFactory.php index 7e2f361..9b0230b 100644 --- a/src/Container/MetadataInterfaceFactory.php +++ b/src/Container/MetadataInterfaceFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; final class MetadataInterfaceFactory { diff --git a/src/Container/PdoConnectionInterfaceFactory.php b/src/Container/PdoConnectionInterfaceFactory.php index 10a4fe6..230d872 100644 --- a/src/Container/PdoConnectionInterfaceFactory.php +++ b/src/Container/PdoConnectionInterfaceFactory.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; use PhpDb\Adapter\AdapterInterface; use PhpDb\Adapter\Driver\PdoConnectionInterface; use PhpDb\Adapter\Exception\InvalidConnectionParametersException; -use PhpDb\Adapter\Pgsql\Exception\ContainerException; -use PhpDb\Adapter\Pgsql\Pdo; +use PhpDb\Exception\ContainerException; +use PhpDb\Pgsql\Pdo; use Psr\Container\ContainerInterface; use function is_array; @@ -29,8 +29,9 @@ public function __invoke( ): PdoConnectionInterface&Pdo\Connection { if (! $container->has('config')) { // todo: Once latest PR is merged for 0.5.0 update to use PhpDB\Exception\ContainerException - throw ContainerException::forServiceFailure( + throw ContainerException::forService( Pdo\Connection::class, + self::class, 'Container is missing a config service' ); } diff --git a/src/Container/PdoDriverInterfaceFactory.php b/src/Container/PdoDriverInterfaceFactory.php index c723ca7..a6e9c03 100644 --- a/src/Container/PdoDriverInterfaceFactory.php +++ b/src/Container/PdoDriverInterfaceFactory.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; use Laminas\ServiceManager\ServiceManager; use PhpDb\Adapter\AdapterInterface; use PhpDb\Adapter\Driver\Pdo\Result; use PhpDb\Adapter\Driver\Pdo\Statement; use PhpDb\Adapter\Driver\PdoDriverInterface; -use PhpDb\Adapter\Pgsql\Exception\ContainerException; -use PhpDb\Adapter\Pgsql\Pdo; +use PhpDb\Exception\ContainerException; +use PhpDb\Pgsql\Pdo; use Psr\Container\ContainerInterface; /** @@ -25,8 +25,9 @@ public function __invoke( ): PdoDriverInterface&Pdo\Driver { if (! $container->has('config')) { // todo: Once latest PR is merged for 0.5.0 update to use PhpDB\Exception\ContainerException - throw ContainerException::forServiceFailure( + throw ContainerException::forService( Pdo\Driver::class, + self::class, 'Container is missing a config service' ); } diff --git a/src/Container/PdoStatementFactory.php b/src/Container/PdoStatementFactory.php index f3caafe..ecf848a 100644 --- a/src/Container/PdoStatementFactory.php +++ b/src/Container/PdoStatementFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; use PhpDb\Adapter\Driver\Pdo\Statement as PdoStatement; use PhpDb\Adapter\Driver\StatementInterface; diff --git a/src/Container/PlatformInterfaceFactory.php b/src/Container/PlatformInterfaceFactory.php index c18f6e6..b34074e 100644 --- a/src/Container/PlatformInterfaceFactory.php +++ b/src/Container/PlatformInterfaceFactory.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; -use PhpDb\Adapter\Pgsql; use PhpDb\Adapter\Platform\PlatformInterface; use PhpDb\Exception\ContainerException; +use PhpDb\Pgsql; use Psr\Container\ContainerInterface; final class PlatformInterfaceFactory diff --git a/src/Container/StatementInterfaceFactory.php b/src/Container/StatementInterfaceFactory.php index 8e95512..e07201c 100644 --- a/src/Container/StatementInterfaceFactory.php +++ b/src/Container/StatementInterfaceFactory.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Container; +namespace PhpDb\Pgsql\Container; use PhpDb\Adapter\Driver\StatementInterface; -use PhpDb\Adapter\Pgsql; +use PhpDb\Pgsql; use Psr\Container\ContainerInterface; final class StatementInterfaceFactory diff --git a/src/DatabasePlatformNameTrait.php b/src/DatabasePlatformNameTrait.php index 519ade3..1a16171 100644 --- a/src/DatabasePlatformNameTrait.php +++ b/src/DatabasePlatformNameTrait.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql; +namespace PhpDb\Pgsql; use PhpDb\Adapter\Driver\DriverInterface; use PhpDb\Adapter\Exception\InvalidArgumentException; diff --git a/src/Driver.php b/src/Driver.php index c7d86fd..b74c11a 100644 --- a/src/Driver.php +++ b/src/Driver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql; +namespace PhpDb\Pgsql; use Override; use PgSql\Result as PgSqlResult; diff --git a/src/Metadata/Source.php b/src/Metadata/Source.php index fd6335e..55f2bf2 100644 --- a/src/Metadata/Source.php +++ b/src/Metadata/Source.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Metadata; +namespace PhpDb\Pgsql\Metadata; use DateTime; use Override; diff --git a/src/Pdo/Connection.php b/src/Pdo/Connection.php index 0840987..afb2c33 100644 --- a/src/Pdo/Connection.php +++ b/src/Pdo/Connection.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Pdo; +namespace PhpDb\Pgsql\Pdo; use Override; use PDO; diff --git a/src/Pdo/Driver.php b/src/Pdo/Driver.php index 9fed4fd..fac12ef 100644 --- a/src/Pdo/Driver.php +++ b/src/Pdo/Driver.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql\Pdo; +namespace PhpDb\Pgsql\Pdo; use Override; use PDOStatement; use PhpDb\Adapter\Driver\Pdo\AbstractPdo; use PhpDb\Adapter\Driver\Pdo\Result; use PhpDb\Adapter\Driver\ResultInterface; -use PhpDb\Adapter\Pgsql\DatabasePlatformNameTrait; +use PhpDb\Pgsql\DatabasePlatformNameTrait; class Driver extends AbstractPdo { diff --git a/src/Result.php b/src/Result.php index 9f71e89..b84b3e6 100644 --- a/src/Result.php +++ b/src/Result.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql; +namespace PhpDb\Pgsql; use Override; use PgSql\Result as PgSqlResult; @@ -89,7 +89,7 @@ public function getAffectedRows(): int } #[Override] - public function getGeneratedValue(): mixed + public function getGeneratedValue(): int|string|false|null { return $this->generatedValue; } diff --git a/src/Statement.php b/src/Statement.php index 6c15e23..a649346 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDb\Adapter\Pgsql; +namespace PhpDb\Pgsql; use Override; use PgSql\Connection as PgSqlConnection; diff --git a/test/asset/SetupTrait.php b/test/asset/SetupTrait.php index 1a2f60e..50a0184 100644 --- a/test/asset/SetupTrait.php +++ b/test/asset/SetupTrait.php @@ -11,9 +11,9 @@ use PhpDb\Adapter\Driver\DriverInterface; use PhpDb\Adapter\Driver\PdoConnectionInterface; use PhpDb\Adapter\Driver\PdoDriverInterface; -use PhpDb\Adapter\Pgsql; use PhpDb\Adapter\Platform\PlatformInterface; use PhpDb\ConfigProvider as PhpDbConfigProvider; +use PhpDb\Pgsql; use Psr\Container\ContainerInterface; use function getenv; @@ -27,11 +27,11 @@ trait SetupTrait protected function setUp(): void { $conn = [ - 'host' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_HOSTNAME'), + 'host' => (string) getenv('TESTS_PHPDB_PGSQL_HOSTNAME'), 'port' => 5432, - 'username' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_USERNAME'), - 'password' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_PASSWORD'), - 'database' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE'), + 'username' => (string) getenv('TESTS_PHPDB_PGSQL_USERNAME'), + 'password' => (string) getenv('TESTS_PHPDB_PGSQL_PASSWORD'), + 'database' => (string) getenv('TESTS_PHPDB_PGSQL_DATABASE'), ]; $this->conn = $conn; parent::setUp(); @@ -87,21 +87,21 @@ public function getMockedAdapter(string $adapter = self::NATIVE_ADAPTER): Adapte self::NATIVE_ADAPTER => [ 'driver' => Pgsql\Driver::class, 'connection' => [ - 'host' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_HOSTNAME'), + 'host' => (string) getenv('TESTS_PHPDB_PGSQL_HOSTNAME'), 'port' => 5432, - 'username' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_USERNAME'), - 'password' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_PASSWORD'), - 'database' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE'), + 'username' => (string) getenv('TESTS_PHPDB_PGSQL_USERNAME'), + 'password' => (string) getenv('TESTS_PHPDB_PGSQL_PASSWORD'), + 'database' => (string) getenv('TESTS_PHPDB_PGSQL_DATABASE'), ], ], self::PDO_ADAPTER => [ 'driver' => Pgsql\Pdo\Driver::class, 'connection' => [ - 'host' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_HOSTNAME'), + 'host' => (string) getenv('TESTS_PHPDB_PGSQL_HOSTNAME'), 'port' => 5432, - 'username' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_USERNAME'), - 'password' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_PASSWORD'), - 'database' => (string) getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE'), + 'username' => (string) getenv('TESTS_PHPDB_PGSQL_USERNAME'), + 'password' => (string) getenv('TESTS_PHPDB_PGSQL_PASSWORD'), + 'database' => (string) getenv('TESTS_PHPDB_PGSQL_DATABASE'), ], ], ], diff --git a/test/integration/AdapterPlatformTest.php b/test/integration/AdapterPlatformTest.php index ad4a0a3..2dca1ed 100644 --- a/test/integration/AdapterPlatformTest.php +++ b/test/integration/AdapterPlatformTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql; +namespace PhpDbIntegrationTest\Pgsql; use PhpDb\Adapter\Exception\VunerablePlatformQuoteException; -use PhpDb\Adapter\Pgsql\AdapterPlatform; +use PhpDb\Pgsql\AdapterPlatform; use PhpDbTestAsset\Pgsql\SetupTrait; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\CoversMethod; diff --git a/test/integration/AdapterTest.php b/test/integration/AdapterTest.php index 4df75a6..8c80a67 100644 --- a/test/integration/AdapterTest.php +++ b/test/integration/AdapterTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql; +namespace PhpDbIntegrationTest\Pgsql; use PhpDb\Adapter\Adapter; use PhpDb\Adapter\AdapterInterface; diff --git a/test/integration/Extension/IntegrationTestStartedListener.php b/test/integration/Extension/IntegrationTestStartedListener.php index 349967a..8618ae5 100644 --- a/test/integration/Extension/IntegrationTestStartedListener.php +++ b/test/integration/Extension/IntegrationTestStartedListener.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql\Extension; +namespace PhpDbIntegrationTest\Pgsql\Extension; use Exception; -use PhpDbIntegrationTest\Adapter\Pgsql\FixtureLoader\FixtureLoaderInterface; -use PhpDbIntegrationTest\Adapter\Pgsql\FixtureLoader\PgsqlFixtureLoader; +use PhpDbIntegrationTest\Pgsql\FixtureLoader\FixtureLoaderInterface; +use PhpDbIntegrationTest\Pgsql\FixtureLoader\PgsqlFixtureLoader; use PHPUnit\Event\TestSuite\Started; use PHPUnit\Event\TestSuite\StartedSubscriber; @@ -27,7 +27,7 @@ public function notify(Started $event): void return; } - if ((bool) getenv('TESTS_PHPDB_ADAPTER_PGSQL')) { + if ((bool) getenv('TESTS_PHPDB_PGSQL')) { $this->fixtureLoaders[] = new PgsqlFixtureLoader(); } diff --git a/test/integration/Extension/IntegrationTestStoppedListener.php b/test/integration/Extension/IntegrationTestStoppedListener.php index dcf1b9f..ccd56d4 100644 --- a/test/integration/Extension/IntegrationTestStoppedListener.php +++ b/test/integration/Extension/IntegrationTestStoppedListener.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql\Extension; +namespace PhpDbIntegrationTest\Pgsql\Extension; -use PhpDbIntegrationTest\Adapter\Pgsql\FixtureLoader\FixtureLoaderInterface; +use PhpDbIntegrationTest\Pgsql\FixtureLoader\FixtureLoaderInterface; use PHPUnit\Event\TestSuite\Finished; use PHPUnit\Event\TestSuite\FinishedSubscriber; diff --git a/test/integration/Extension/ListenerExtension.php b/test/integration/Extension/ListenerExtension.php index 9f0f171..ba9cd13 100644 --- a/test/integration/Extension/ListenerExtension.php +++ b/test/integration/Extension/ListenerExtension.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql\Extension; +namespace PhpDbIntegrationTest\Pgsql\Extension; use PHPUnit\Runner\Extension\Extension; use PHPUnit\Runner\Extension\Facade; diff --git a/test/integration/FixtureLoader/FixtureLoaderInterface.php b/test/integration/FixtureLoader/FixtureLoaderInterface.php index a2cc82b..54659b7 100644 --- a/test/integration/FixtureLoader/FixtureLoaderInterface.php +++ b/test/integration/FixtureLoader/FixtureLoaderInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql\FixtureLoader; +namespace PhpDbIntegrationTest\Pgsql\FixtureLoader; interface FixtureLoaderInterface { diff --git a/test/integration/FixtureLoader/PgsqlFixtureLoader.php b/test/integration/FixtureLoader/PgsqlFixtureLoader.php index c54a7c5..a9655f2 100644 --- a/test/integration/FixtureLoader/PgsqlFixtureLoader.php +++ b/test/integration/FixtureLoader/PgsqlFixtureLoader.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql\FixtureLoader; +namespace PhpDbIntegrationTest\Pgsql\FixtureLoader; use Exception; use PDO; @@ -34,12 +34,12 @@ public function createDatabase(): void if ( false === $this->pdo->exec(sprintf( "CREATE DATABASE %s", - getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE') + getenv('TESTS_PHPDB_PGSQL_DATABASE') )) ) { throw new Exception(sprintf( "I cannot create the PostgreSQL %s test database: %s", - getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE'), + getenv('TESTS_PHPDB_PGSQL_DATABASE'), print_r($this->pdo->errorInfo(), true) )); } @@ -52,7 +52,7 @@ public function createDatabase(): void if (false === $this->pdo->exec(file_get_contents($this->fixtureFile))) { throw new Exception(sprintf( "I cannot create the table for %s database. Check the %s file. %s ", - getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE'), + getenv('TESTS_PHPDB_PGSQL_DATABASE'), $this->fixtureFile, print_r($this->pdo->errorInfo(), true) )); @@ -75,7 +75,7 @@ public function dropDatabase(): void $this->pdo->exec(sprintf( "DROP DATABASE IF EXISTS %s", - getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE') + getenv('TESTS_PHPDB_PGSQL_DATABASE') )); $this->disconnect(); @@ -86,16 +86,16 @@ public function dropDatabase(): void */ protected function connect(bool $useDb = false): void { - $dsn = 'pgsql:host=' . getenv('TESTS_PHPDB_ADAPTER_PGSQL_HOSTNAME'); + $dsn = 'pgsql:host=' . getenv('TESTS_PHPDB_PGSQL_HOSTNAME'); if ($useDb) { - $dsn .= ';dbname=' . getenv('TESTS_PHPDB_ADAPTER_PGSQL_DATABASE'); + $dsn .= ';dbname=' . getenv('TESTS_PHPDB_PGSQL_DATABASE'); } $this->pdo = new PDO( $dsn, - getenv('TESTS_PHPDB_ADAPTER_PGSQL_USERNAME'), - getenv('TESTS_PHPDB_ADAPTER_PGSQL_PASSWORD') + getenv('TESTS_PHPDB_PGSQL_USERNAME'), + getenv('TESTS_PHPDB_PGSQL_PASSWORD') ); } diff --git a/test/integration/Pdo/AdapterTest.php b/test/integration/Pdo/AdapterTest.php index 16273be..50b23a8 100644 --- a/test/integration/Pdo/AdapterTest.php +++ b/test/integration/Pdo/AdapterTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql\Pdo; +namespace PhpDbIntegrationTest\Pgsql\Pdo; use PhpDb\Adapter\Adapter; use PhpDb\Adapter\AdapterInterface; diff --git a/test/integration/Pdo/TableGatewayTest.php b/test/integration/Pdo/TableGatewayTest.php index 1e08c9c..56d8849 100644 --- a/test/integration/Pdo/TableGatewayTest.php +++ b/test/integration/Pdo/TableGatewayTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDbIntegrationTest\Adapter\Pgsql\Pdo; +namespace PhpDbIntegrationTest\Pgsql\Pdo; use PhpDb\Sql\TableIdentifier; use PhpDb\TableGateway\Feature\FeatureSet; diff --git a/test/unit/Adapter/ConfigProviderTest.php b/test/unit/Adapter/ConfigProviderTest.php index c539f15..b887706 100644 --- a/test/unit/Adapter/ConfigProviderTest.php +++ b/test/unit/Adapter/ConfigProviderTest.php @@ -9,11 +9,11 @@ use PhpDb\Adapter\Driver\Pdo\Statement as PdoStatement; use PhpDb\Adapter\Driver\PdoConnectionInterface; use PhpDb\Adapter\Driver\PdoDriverInterface; -use PhpDb\Adapter\Pgsql; -use PhpDb\Adapter\Pgsql\Pdo\Connection as PdoConnection; -use PhpDb\Adapter\Pgsql\Pdo\Driver as PdoDriver; use PhpDb\Adapter\Platform\PlatformInterface; use PhpDb\Metadata\MetadataInterface; +use PhpDb\Pgsql; +use PhpDb\Pgsql\Pdo\Connection as PdoConnection; +use PhpDb\Pgsql\Pdo\Driver as PdoDriver; use PHPUnit\Framework\Attributes\CoversMethod; use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\TestCase; diff --git a/test/unit/Adapter/SetupTest.php b/test/unit/Adapter/SetupTest.php index 58b4209..a1a3b1e 100644 --- a/test/unit/Adapter/SetupTest.php +++ b/test/unit/Adapter/SetupTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhpDbTest\Adapter\Pgsql\Adapter; +namespace PhpDbTest\Pgsql; use PhpDb\Adapter\AdapterInterface; use PhpDbTestAsset\Pgsql\SetupTrait; @@ -22,7 +22,7 @@ public function testAdapterAbstractFactoryBuildsNativeDriver(): void public function testAdapterInterfaceFactoryBuildsNativeDriver(): void { - $adapter = $this->getAdapter(AdapterInterface::class); + $adapter = $this->getAdapter(self::NATIVE_ADAPTER); self::assertInstanceOf(AdapterInterface::class, $adapter); } }