Skip to content

Commit

Permalink
wip fix PostgreSQL LIKE binary
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Apr 29, 2024
1 parent 9d5206a commit 5450227
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/ConditionSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,19 +704,18 @@ public function testRegexpCondition(string $type, bool $isBinary): void
: false;
// TODO investigate/report MySQL 8.x bug
$isBinaryMysql8x = $this->getDatabasePlatform() instanceof MySQLPlatform && $isBinary && !$isMysql5x && !$isMariadb;
// TODO investigate PostgreSQL internal bug
$isBinaryPostgresql = $this->getDatabasePlatform() instanceof PostgreSQLPlatform && $isBinary;

self::assertSame([1], $findIdsRegexFx('name', 'John'));
self::assertSame($isBinary ? [] : [1], $findIdsRegexFx('name', 'john'));

if ($this->getDatabasePlatform() instanceof PostgreSQLPlatform && $isBinary) {
return; // TODO
}

self::assertSame($isBinaryMysql8x ? [] : [13], $findIdsRegexFx('name', 'heiß'));
self::assertSame($isBinary ? [] : [13], $findIdsRegexFx('name', 'Heiß'));
self::assertSame([1], $findIdsRegexFx('name', 'Joh'));
self::assertSame([1], $findIdsRegexFx('name', 'ohn'));
self::assertSame([1, 2, 3, ...($this->getDatabasePlatform() instanceof OraclePlatform ? [] : [4]), 13, 14, 15, 16], $findIdsRegexFx('name', 'a', true));
if (!$isBinaryPostgresql) {
self::assertSame([1, 2, 3, ...($this->getDatabasePlatform() instanceof OraclePlatform ? [] : [4]), 13, 14, 15, 16], $findIdsRegexFx('name', 'a', true));
}

self::assertSame([1], $findIdsRegexFx('c', '1'));
self::assertSame([2], $findIdsRegexFx('c', '2000'));
Expand Down Expand Up @@ -801,7 +800,9 @@ public function testRegexpCondition(string $type, bool $isBinary): void
}

if (!$this->getDatabasePlatform() instanceof MySQLPlatform || $isMariadb) {
self::assertSame([2, 5, 6, 7, 8, 9, 10, 11, 12], $findIdsRegexFx('name', '([ae]).+\1'));
if (!$isBinaryPostgresql) {
self::assertSame([2, 5, 6, 7, 8, 9, 10, 11, 12], $findIdsRegexFx('name', '([ae]).+\1'));
}
}

if ((!$this->getDatabasePlatform() instanceof MySQLPlatform || !$isMysql5x) && !$this->getDatabasePlatform() instanceof OraclePlatform) {
Expand Down

0 comments on commit 5450227

Please sign in to comment.