Skip to content

Commit 28a947b

Browse files
Update tests
1 parent 1b455bc commit 28a947b

File tree

4 files changed

+34
-19
lines changed

4 files changed

+34
-19
lines changed

tests/Platforms/AbstractMySQLPlatformTestCase.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Doctrine\DBAL\Schema\Table;
2121
use Doctrine\DBAL\TransactionIsolationLevel;
2222
use Doctrine\DBAL\Types\Types;
23+
use PHPUnit\Framework\Attributes\DataProvider;
2324

2425
use function array_shift;
2526

@@ -622,6 +623,13 @@ protected function createComparator(): Comparator
622623
);
623624
}
624625

626+
/** @param array<string> $values */
627+
#[DataProvider('getEnumDeclarationExceptionWithLengthSQLProvider')]
628+
public function testGetEnumDeclarationExceptionWithLengthSQL(array $values, int $length): void
629+
{
630+
self::markTestSkipped('There is no exception thrown on MySQL.');
631+
}
632+
625633
/** @return array<string, array{array<string>, string}> */
626634
public static function getEnumDeclarationSQLProvider(): array
627635
{
@@ -631,7 +639,7 @@ public static function getEnumDeclarationSQLProvider(): array
631639
];
632640
}
633641

634-
/** @return array<string, array{array<string>, int, string|null}> */
642+
/** @return array<string, array{array<string>, int, string}> */
635643
public static function getEnumDeclarationWithLengthSQLProvider(): array
636644
{
637645
return [

tests/Platforms/AbstractPlatformTestCase.php

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,32 +1220,43 @@ public static function getEnumDeclarationSQLProvider(): array
12201220

12211221
/** @param array<string> $values */
12221222
#[DataProvider('getEnumDeclarationWithLengthSQLProvider')]
1223-
public function testGetEnumDeclarationWithLengthSQL(array $values, int $length, ?string $expectedSQL = null): void
1223+
public function testGetEnumDeclarationWithLengthSQL(array $values, int $length, string $expectedSQL): void
12241224
{
1225-
if ($expectedSQL === null) {
1226-
$this->expectException(InvalidArgumentException::class);
1227-
}
1228-
12291225
$result = $this->platform->getEnumDeclarationSQL([
12301226
'values' => $values,
12311227
'length' => $length,
12321228
]);
12331229

1234-
if ($expectedSQL === null) {
1235-
return;
1236-
}
1237-
12381230
self::assertSame($expectedSQL, $result);
12391231
}
12401232

1241-
/** @return array<string, array{array<string>, int, string|null}> */
1233+
/** @param array<string> $values */
1234+
#[DataProvider('getEnumDeclarationExceptionWithLengthSQLProvider')]
1235+
public function testGetEnumDeclarationExceptionWithLengthSQL(array $values, int $length): void
1236+
{
1237+
$this->expectException(InvalidArgumentException::class);
1238+
1239+
$this->platform->getEnumDeclarationSQL([
1240+
'values' => $values,
1241+
'length' => $length,
1242+
]);
1243+
}
1244+
1245+
/** @return array<string, array{array<string>, int, string}> */
12421246
public static function getEnumDeclarationWithLengthSQLProvider(): array
12431247
{
12441248
return [
12451249
'single value and bigger length' => [['foo'], 42, 'VARCHAR(42)'],
1246-
'single value and lower length' => [['foo'], 1, null],
12471250
'multiple values and bigger length' => [['foo', 'bar1'], 42, 'VARCHAR(42)'],
1248-
'multiple values and lower length' => [['foo', 'bar1'], 2, null],
1251+
];
1252+
}
1253+
1254+
/** @return array<string, array{array<string>, int}> */
1255+
public static function getEnumDeclarationExceptionWithLengthSQLProvider(): array
1256+
{
1257+
return [
1258+
'single value and lower length' => [['foo'], 1],
1259+
'multiple values and lower length' => [['foo', 'bar1'], 2],
12491260
];
12501261
}
12511262

tests/Platforms/OraclePlatformTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,14 +652,12 @@ public static function getEnumDeclarationSQLProvider(): array
652652
];
653653
}
654654

655-
/** @return array<string, array{array<string>, int, string|null}> */
655+
/** @return array<string, array{array<string>, int, string}> */
656656
public static function getEnumDeclarationWithLengthSQLProvider(): array
657657
{
658658
return [
659659
'single value and bigger length' => [['foo'], 42, 'VARCHAR2(42)'],
660-
'single value and lower length' => [['foo'], 1, null],
661660
'multiple values and bigger length' => [['foo', 'bar1'], 42, 'VARCHAR2(42)'],
662-
'multiple values and lower length' => [['foo', 'bar1'], 2, null],
663661
];
664662
}
665663
}

tests/Platforms/SQLServerPlatformTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,14 +1226,12 @@ public static function getEnumDeclarationSQLProvider(): array
12261226
];
12271227
}
12281228

1229-
/** @return array<string, array{array<string>, int, string|null}> */
1229+
/** @return array<string, array{array<string>, int, string}> */
12301230
public static function getEnumDeclarationWithLengthSQLProvider(): array
12311231
{
12321232
return [
12331233
'single value and bigger length' => [['foo'], 42, 'NVARCHAR(42)'],
1234-
'single value and lower length' => [['foo'], 1, null],
12351234
'multiple values and bigger length' => [['foo', 'bar1'], 42, 'NVARCHAR(42)'],
1236-
'multiple values and lower length' => [['foo', 'bar1'], 2, null],
12371235
];
12381236
}
12391237
}

0 commit comments

Comments
 (0)