diff --git a/src/lib/doctrine-dbal-bulk/README.md b/src/lib/doctrine-dbal-bulk/README.md index f6fa17932..e8c0df00e 100644 --- a/src/lib/doctrine-dbal-bulk/README.md +++ b/src/lib/doctrine-dbal-bulk/README.md @@ -56,6 +56,8 @@ $bulk->update( ## Supported Dialects * PostgreSQL +* MySQL / MariaDB +* SQLite ### Adding new Dialects @@ -79,4 +81,4 @@ example: `dialect_option?: string` [DbalPlatform](src/Flow/Doctrine/Bulk/DbalPlatform.php) is a factory that detects which Dialect should be used for given -Doctrine DBAL Platform. \ No newline at end of file +Doctrine DBAL Platform. diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/DbalPlatform.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/DbalPlatform.php index f6033ecc4..9d0c623ac 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/DbalPlatform.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/DbalPlatform.php @@ -15,8 +15,6 @@ /** * @infection-ignore-all - * - * @codeCoverageIgnore */ final class DbalPlatform { diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php index c8989d325..9be316fd4 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php @@ -11,7 +11,7 @@ use Flow\Doctrine\Bulk\QueryFactory; use Flow\Doctrine\Bulk\TableDefinition; -class DbalQueryFactory implements QueryFactory +final class DbalQueryFactory implements QueryFactory { /** * @param AbstractPlatform $platform diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php index e0dfd5ead..50a7135e0 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php @@ -2,13 +2,16 @@ namespace Flow\Doctrine\Bulk\Tests\Unit; +use Doctrine\DBAL\Platforms\MariaDBPlatform; use Doctrine\DBAL\Platforms\MySQL80Platform; +use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; use Flow\Doctrine\Bulk\DbalPlatform; use Flow\Doctrine\Bulk\Dialect\MySQLDialect; use Flow\Doctrine\Bulk\Dialect\PostgreSQLDialect; use Flow\Doctrine\Bulk\Dialect\SqliteDialect; +use Flow\Doctrine\Bulk\Exception\RuntimeException; use PHPUnit\Framework\TestCase; final class DbalPlatformTest extends TestCase @@ -20,6 +23,13 @@ public function test_is_mysql() : void $this->assertInstanceOf(MySQLDialect::class, $platform->dialect()); } + public function test_is_mysql_with_mariadb() : void + { + $platform = new DbalPlatform(new MariaDBPlatform()); + + $this->assertInstanceOf(MySQLDialect::class, $platform->dialect()); + } + public function test_is_postgres_sql() : void { $platform = new DbalPlatform(new PostgreSQLPlatform()); @@ -33,4 +43,13 @@ public function test_is_sqlite_sql() : void $this->assertInstanceOf(SqliteDialect::class, $platform->dialect()); } + + public function test_no_supported_platform() : void + { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('Database platform "Doctrine\DBAL\Platforms\OraclePlatform" is not yet supported'); + + $platform = new DbalPlatform(new OraclePlatform()); + $platform->dialect(); + } }