Skip to content

Commit bd799b2

Browse files
committed
Merge branch '3.10.x' into 4.3.x
* 3.10.x: Fix argument count of data providers (#7076)
2 parents 7669f13 + 7090efb commit bd799b2

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

tests/Platforms/PostgreSQLPlatformTest.php

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Doctrine\DBAL\TransactionIsolationLevel;
1919
use Doctrine\DBAL\Types\Type;
2020
use Doctrine\DBAL\Types\Types;
21+
use Generator;
2122
use PHPUnit\Framework\Attributes\DataProvider;
2223
use UnexpectedValueException;
2324

@@ -404,14 +405,22 @@ protected function getQuotedColumnInForeignKeySQL(): array
404405
];
405406
}
406407

407-
#[DataProvider('pgBooleanProvider')]
408+
#[DataProvider('provideConvertBooleansAsLiteralStrings')]
408409
public function testConvertBooleanAsLiteralStrings(
409410
string $databaseValue,
410411
string $preparedStatementValue,
411412
): void {
412413
self::assertEquals($preparedStatementValue, $this->platform->convertBooleans($databaseValue));
413414
}
414415

416+
/** @return Generator<int, array{string, string}> */
417+
public static function provideConvertBooleansAsLiteralStrings(): Generator
418+
{
419+
foreach (self::pgBooleanProvider() as $key => $params) {
420+
yield $key => [$params[0], $params[1]];
421+
}
422+
}
423+
415424
public function testConvertBooleanAsLiteralIntegers(): void
416425
{
417426
$this->platform->setUseBooleanTrueFalseStrings(false);
@@ -423,16 +432,22 @@ public function testConvertBooleanAsLiteralIntegers(): void
423432
self::assertEquals(0, $this->platform->convertBooleans('0'));
424433
}
425434

426-
#[DataProvider('pgBooleanProvider')]
435+
#[DataProvider('provideConvertBooleanAsDatabaseValueStrings')]
427436
public function testConvertBooleanAsDatabaseValueStrings(
428-
string $databaseValue,
429-
string $preparedStatementValue,
430437
int $integerValue,
431438
bool $booleanValue,
432439
): void {
433440
self::assertSame($integerValue, $this->platform->convertBooleansToDatabaseValue($booleanValue));
434441
}
435442

443+
/** @return Generator<int, array{int, bool}> */
444+
public static function provideConvertBooleanAsDatabaseValueStrings(): Generator
445+
{
446+
foreach (self::pgBooleanProvider() as $key => $params) {
447+
yield $key => [$params[2], $params[3]];
448+
}
449+
}
450+
436451
public function testConvertBooleanAsDatabaseValueIntegers(): void
437452
{
438453
$this->platform->setUseBooleanTrueFalseStrings(false);
@@ -441,16 +456,22 @@ public function testConvertBooleanAsDatabaseValueIntegers(): void
441456
self::assertSame(0, $this->platform->convertBooleansToDatabaseValue(false));
442457
}
443458

444-
#[DataProvider('pgBooleanProvider')]
459+
#[DataProvider('provideConvertFromBoolean')]
445460
public function testConvertFromBoolean(
446461
string $databaseValue,
447-
string $prepareStatementValue,
448-
int $integerValue,
449462
bool $booleanValue,
450463
): void {
451464
self::assertSame($booleanValue, $this->platform->convertFromBoolean($databaseValue));
452465
}
453466

467+
/** @return Generator<int, array{string, bool}> */
468+
public static function provideConvertFromBoolean(): Generator
469+
{
470+
foreach (self::pgBooleanProvider() as $key => $params) {
471+
yield $key => [$params[0], $params[3]];
472+
}
473+
}
474+
454475
public function testThrowsExceptionWithInvalidBooleanLiteral(): void
455476
{
456477
$this->expectException(UnexpectedValueException::class);
@@ -719,7 +740,7 @@ protected function getQuotedAlterTableRenameIndexSQL(): array
719740
/**
720741
* PostgreSQL boolean strings provider
721742
*
722-
* @return mixed[][]
743+
* @return list<array{string, string, int, bool}>
723744
*/
724745
public static function pgBooleanProvider(): iterable
725746
{

0 commit comments

Comments
 (0)