diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index ae5893f5..c625a000 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -25,9 +25,48 @@ name: Composer require checker jobs: composer-require-checker: - uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master - with: - os: >- - ['ubuntu-latest'] - php: >- - ['8.0', '8.1'] + name: PHP ${{ matrix.php }} + + env: + COMPOSER_ROOT_VERSION: dev-master + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + + php: + - 8.0 + - 8.1 + - 8.2 + + steps: + - name: Checkout. + uses: actions/checkout@v3 + + - name: Install PHP with extensions. + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: composer:v2 + + - name: Update composer. + run: composer self-update + + - name: Set environment variables pull request linux. + uses: yiisoft/actions/db/environment-linux@master + + - name: Install db. + uses: yiisoft/actions/db/subpackage-install@master + with: + BRANCH_NAME: ${{ env.BRANCH_NAME }} + COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }} + CURRENT_PACKAGE: db + FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} + WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} + + - name: Check dependencies. + run: vendor/bin/composer-require-checker diff --git a/src/Command.php b/src/Command.php index 76ab485d..85845a7a 100644 --- a/src/Command.php +++ b/src/Command.php @@ -6,8 +6,8 @@ use PDOException; use Throwable; -use Yiisoft\Db\Driver\PDO\AbstractCommandPDO; -use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface; +use Yiisoft\Db\Driver\Pdo\AbstractPdoCommand; +use Yiisoft\Db\Driver\Pdo\PdoConnectionInterface; use Yiisoft\Db\Exception\ConvertException; use Yiisoft\Db\QueryBuilder\QueryBuilderInterface; @@ -15,7 +15,7 @@ * Implements a database command that can be executed with a PDO (PHP Data Object) database connection for MySQL, * MariaDB. */ -final class Command extends AbstractCommandPDO +final class Command extends AbstractPdoCommand { public function insertWithReturningPks(string $table, array $columns): bool|array { @@ -75,7 +75,7 @@ protected function internalExecute(string|null $rawSql): void && $this->db->getTransaction() === null ) { $this->db->transaction( - fn (ConnectionPDOInterface $db) => $this->internalExecute($rawSql), + fn (PdoConnectionInterface $db) => $this->internalExecute($rawSql), $this->isolationLevel, ); } else { diff --git a/src/Connection.php b/src/Connection.php index 532b9d64..efe3219b 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -6,8 +6,8 @@ use Exception; use Psr\Log\LogLevel; -use Yiisoft\Db\Driver\PDO\AbstractConnectionPDO; -use Yiisoft\Db\Driver\PDO\CommandPDOInterface; +use Yiisoft\Db\Driver\Pdo\AbstractPdoConnection; +use Yiisoft\Db\Driver\Pdo\PdoCommandInterface; use Yiisoft\Db\QueryBuilder\QueryBuilderInterface; use Yiisoft\Db\Schema\QuoterInterface; use Yiisoft\Db\Schema\SchemaInterface; @@ -18,7 +18,7 @@ * * @link https://www.php.net/manual/en/ref.pdo-mysql.php */ -final class Connection extends AbstractConnectionPDO +final class Connection extends AbstractPdoConnection { public function close(): void { @@ -39,7 +39,7 @@ public function close(): void } } - public function createCommand(string $sql = null, array $params = []): CommandPDOInterface + public function createCommand(string $sql = null, array $params = []): PdoCommandInterface { $command = new Command($this); diff --git a/src/Driver.php b/src/Driver.php index 0152c5d2..a62b2d80 100644 --- a/src/Driver.php +++ b/src/Driver.php @@ -5,14 +5,14 @@ namespace Yiisoft\Db\Mysql; use PDO; -use Yiisoft\Db\Driver\PDO\AbstractPDODriver; +use Yiisoft\Db\Driver\Pdo\AbstractPdoDriver; /** * Implements the MySQL, MariaDB driver based on the PDO (PHP Data Objects) extension. * * @link https://www.php.net/manual/en/ref.pdo-mysql.php */ -final class Driver extends AbstractPDODriver +final class Driver extends AbstractPdoDriver { public function createConnection(): PDO { diff --git a/src/Schema.php b/src/Schema.php index 763b8ac2..3f6514d9 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -9,7 +9,7 @@ use Yiisoft\Db\Constraint\Constraint; use Yiisoft\Db\Constraint\ForeignKeyConstraint; use Yiisoft\Db\Constraint\IndexConstraint; -use Yiisoft\Db\Driver\PDO\PdoAbstractSchema; +use Yiisoft\Db\Driver\Pdo\AbstractPdoSchema; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidConfigException; use Yiisoft\Db\Exception\NotSupportedException; @@ -92,7 +92,7 @@ * } * > */ -final class Schema extends PdoAbstractSchema +final class Schema extends AbstractPdoSchema { /** * @var array Mapping from physical column types (keys) to abstract column types (values). diff --git a/src/Transaction.php b/src/Transaction.php index 5eaaf6b2..af2cd1f3 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -4,11 +4,11 @@ namespace Yiisoft\Db\Mysql; -use Yiisoft\Db\Driver\PDO\AbstractTransactionPDO; +use Yiisoft\Db\Driver\Pdo\AbstractPdoTransaction; /** * Implements the MySQL, MariaDB specific transaction. */ -final class Transaction extends AbstractTransactionPDO +final class Transaction extends AbstractPdoTransaction { } diff --git a/tests/CommandJSONTest.php b/tests/JsonCommandTest.php similarity index 98% rename from tests/CommandJSONTest.php rename to tests/JsonCommandTest.php index a03184bc..8d1dcaed 100644 --- a/tests/CommandJSONTest.php +++ b/tests/JsonCommandTest.php @@ -14,7 +14,7 @@ * * @psalm-suppress PropertyNotSetInConstructor */ -final class CommandJSONTest extends TestCase +final class JsonCommandTest extends TestCase { use TestTrait; diff --git a/tests/CommandPDOTest.php b/tests/PdoCommandTest.php similarity index 66% rename from tests/CommandPDOTest.php rename to tests/PdoCommandTest.php index ff6a441e..c62eccd7 100644 --- a/tests/CommandPDOTest.php +++ b/tests/PdoCommandTest.php @@ -5,14 +5,14 @@ namespace Yiisoft\Db\Mysql\Tests; use Yiisoft\Db\Mysql\Tests\Support\TestTrait; -use Yiisoft\Db\Tests\Common\CommonCommandPDOTest; +use Yiisoft\Db\Tests\Common\CommonPdoCommandTest; /** * @group mysql * * @psalm-suppress PropertyNotSetInConstructor */ -final class CommandPDOTest extends CommonCommandPDOTest +final class PdoCommandTest extends CommonPdoCommandTest { use TestTrait; } diff --git a/tests/ConnectionPDOTest.php b/tests/PdoConnectionTest.php similarity index 93% rename from tests/ConnectionPDOTest.php rename to tests/PdoConnectionTest.php index 04c02e5d..c66e8c30 100644 --- a/tests/ConnectionPDOTest.php +++ b/tests/PdoConnectionTest.php @@ -5,19 +5,19 @@ namespace Yiisoft\Db\Mysql\Tests; use Throwable; -use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface; +use Yiisoft\Db\Driver\Pdo\PdoConnectionInterface; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidCallException; use Yiisoft\Db\Exception\InvalidConfigException; use Yiisoft\Db\Mysql\Tests\Support\TestTrait; -use Yiisoft\Db\Tests\Common\CommonConnectionPDOTest; +use Yiisoft\Db\Tests\Common\CommonPdoConnectionTest; /** * @group mysql * * @psalm-suppress PropertyNotSetInConstructor */ -final class ConnectionPDOTest extends CommonConnectionPDOTest +final class PdoConnectionTest extends CommonPdoConnectionTest { use TestTrait; @@ -96,7 +96,7 @@ public function testGetLastInsertID(): void public function testTransactionAutocommit() { $db = $this->getConnection(true); - $db->transaction(function (ConnectionPDOInterface $db) { + $db->transaction(function (PdoConnectionInterface $db) { $this->assertTrue($db->getTransaction()->isActive()); // create table will cause the transaction to be implicitly committed diff --git a/tests/SchemaTest.php b/tests/SchemaTest.php index a0494c65..ba6aed10 100644 --- a/tests/SchemaTest.php +++ b/tests/SchemaTest.php @@ -9,7 +9,7 @@ use Yiisoft\Db\Command\CommandInterface; use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Constraint\Constraint; -use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface; +use Yiisoft\Db\Driver\Pdo\PdoConnectionInterface; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidConfigException; use Yiisoft\Db\Exception\NotSupportedException; @@ -407,7 +407,7 @@ public function testTableSchemaWithDbSchemes( $commandMock = $this->createMock(CommandInterface::class); $commandMock->method('queryAll')->willReturn([]); - $mockDb = $this->createMock(ConnectionPDOInterface::class); + $mockDb = $this->createMock(PdoConnectionInterface::class); $mockDb->method('getQuoter')->willReturn($db->getQuoter()); $mockDb ->method('createCommand') diff --git a/tests/Support/TestTrait.php b/tests/Support/TestTrait.php index dd0eac42..8f84925c 100644 --- a/tests/Support/TestTrait.php +++ b/tests/Support/TestTrait.php @@ -4,17 +4,17 @@ namespace Yiisoft\Db\Mysql\Tests\Support; -use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface; +use Yiisoft\Db\Driver\Pdo\PdoConnectionInterface; use Yiisoft\Db\Mysql\Connection; -use Yiisoft\Db\Mysql\Dsn; use Yiisoft\Db\Mysql\Driver; +use Yiisoft\Db\Mysql\Dsn; use Yiisoft\Db\Tests\Support\DbHelper; trait TestTrait { private string $dsn = ''; - protected function getConnection(bool $fixture = false): ConnectionPDOInterface + protected function getConnection(bool $fixture = false): PdoConnectionInterface { $db = new Connection(new Driver($this->getDsn(), 'root', ''), DbHelper::getSchemaCache()); @@ -25,7 +25,7 @@ protected function getConnection(bool $fixture = false): ConnectionPDOInterface return $db; } - protected static function getDb(): ConnectionPDOInterface + protected static function getDb(): PdoConnectionInterface { $dsn = (new Dsn('mysql', '127.0.0.1', 'yiitest', '3306', ['charset' => 'utf8mb4']))->asString();