10000 Add test cases for MariaDBPlatform · symfony/symfony@618de82 · GitHub
[go: up one dir, main page]

Skip to content

Commit 618de82

Browse files
committed
Add test cases for MariaDBPlatform
1 parent e789e08 commit 618de82

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

src/Symfony/Bridge/Doctrine/Tests/Types/UlidTypeTest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Doctrine\Tests\Types;
1313

1414
use Doctrine\DBAL\Platforms\AbstractPlatform;
15+
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1516
use Doctrine\DBAL\Platforms\MySQLPlatform;
1617
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1718
use Doctrine\DBAL\Platforms\SqlitePlatform;
@@ -140,13 +141,15 @@ public function testGetGuidTypeDeclarationSQL(AbstractPlatform $platform, string
140141
$this->assertEquals($expectedDeclaration, $this->type->getSqlDeclaration(['length' => 36], $platform));
141142
}
142143

143-
public static function provideSqlDeclarations(): array
144+
public static function provideSqlDeclarations(): \Generator
144145
{
145-
return [
146-
[new PostgreSQLPlatform(), 'UUID'],
147-
[new SqlitePlatform(), 'BLOB'],
148-
[new MySQLPlatform(), 'BINARY(16)'],
149-
];
146+
yield [new PostgreSQLPlatform(), 'UUID'];
147+
yield [new SqlitePlatform(), 'BLOB'];
148+
yield [new MySQLPlatform(), 'BINARY(16)'];
149+
150+
if (class_exists(MariaDBPlatform::class)) {
151+
yield [new MariaDBPlatform(), 'BINARY(16)'];
152+
}
150153
}
151154

152155
public function testRequiresSQLCommentHint()

src/Symfony/Bridge/Doctrine/Tests/Types/UuidTypeTest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Doctrine\Tests\Types;
1313

1414
use Doctrine\DBAL\Platforms\AbstractPlatform;
15+
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1516
use Doctrine\DBAL\Platforms\MySQLPlatform;
1617
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1718
use Doctrine\DBAL\Platforms\SqlitePlatform;
@@ -152,13 +153,15 @@ public function testGetGuidTypeDeclarationSQL(AbstractPlatform $platform, string
152153
$this->assertEquals($expectedDeclaration, $this->type->getSqlDeclaration(['length' => 36], $platform));
153154
}
154155

155-
public static function provideSqlDeclarations(): array
156+
public static function provideSqlDeclarations(): \Generator
156157
{
157-
return [
158-
[new PostgreSQLPlatform(), 'UUID'],
159-
[new SqlitePlatform(), 'BLOB'],
160-
[new MySQLPlatform(), 'BINARY(16)'],
161-
];
158+
yield [new PostgreSQLPlatform(), 'UUID'];
159+
yield [new SqlitePlatform(), 'BLOB'];
160+
yield [new MySQLPlatform(), 'BINARY(16)'];
161+
162+
if (class_exists(MariaDBPlatform::class)) {
163+
yield [new MariaDBPlatform(), 'BINARY(16)'];
164+
}
162165
}
163166

164167
public function testRequiresSQLCommentHint()

src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Doctrine\DBAL\Driver\ResultStatement;
1818
use Doctrine\DBAL\Exception as DBALException;
1919
use Doctrine\DBAL\Platforms\AbstractPlatform;
20+
use Doctrine\DBAL\Platforms\MariaDBPlatform;
2021
use Doctrine\DBAL\Platforms\MySQL57Platform;
2122
use Doctrine\DBAL\Platforms\OraclePlatform;
2223
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
@@ -394,6 +395,13 @@ public static function providePlatformSql(): iterable
394395
'SELECT m.* FROM messenger_messages m WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) ORDER BY available_at ASC LIMIT 1 FOR UPDATE',
395396
];
396397

398+
if (class_exists(MariaDBPlatform::class)) {
399+
yield 'MariaDB' => [
400+
new MariaDBPlatform(),
401+
'SELECT m.* FROM messenger_messages m WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) ORDER BY available_at ASC LIMIT 1 FOR UPDATE',
402+
];
403+
}
404+
397405
yield 'SQL Server' => [
398406
new SQLServer2012Platform(),
399407
'SELECT m.* FROM messenger_messages m WITH (UPDLOCK, ROWLOCK) WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) ORDER BY available_at ASC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY ',
@@ -479,6 +487,13 @@ public function provideFindAllSqlGeneratedByPlatform(): iterable
479487
'SELECT m.* FROM messenger_messages m WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) LIMIT 50',
480488
];
481489

490+
if (class_exists(MariaDBPlatform::class)) {
491+
yield 'MariaDB' => [
492+
new MariaDBPlatform(),
493+
'SELECT m.* FROM messenger_messages m WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) LIMIT 50',
494+
];
495+
}
496+
482497
yield 'SQL Server' => [
483498
new SQLServer2012Platform(),
484499
'SELECT m.* FROM messenger_messages m WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 50 ROWS ONLY',

0 commit comments

Comments
 (0)
0