From 61f1736c0bd288fc62de7783916919e6f3be67ee Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Wed, 14 Oct 2026 11:03:27 +0300 Subject: [PATCH 1/2] Fix Identifier tests --- tests/QueryBuilderTest.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php index 45d4c3644..7e79603f6 100644 --- a/tests/QueryBuilderTest.php +++ b/tests/QueryBuilderTest.php @@ -5,6 +5,7 @@ namespace Yiisoft\Db\Pgsql\Tests; use Closure; +use InvalidArgumentException; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProviderExternal; use PHPUnit\Framework\Attributes\TestWith; @@ -686,8 +687,6 @@ public static function dataBuildIdentifier(): iterable yield ['s.t.name', '"s"."t"."name"']; yield [['t', 'na.me'], '"t"."na.me"']; yield ['LOWER(name)', '"LOWER(name)"']; - yield ['[[name]]', '"[[name]]"']; - yield ['{{%t}}.name', '"{{%t}}"."name"']; yield ['*', '"*"']; yield ['arr[1]', '"arr[1]"']; yield ['a"b', '"a""b"']; @@ -701,4 +700,23 @@ public function testBuildIdentifier(string|array $name, string $expected): void $this->assertSame($expected, $qb->buildExpression(new Identifier($name))); } + + public static function dataBuildIdentifierWithQuoteSqlSequences(): iterable + { + yield ['[[name]]', '"[[name]]"']; + yield ['{{%t}}.name', '"{{%t}}"."name"']; + } + + #[DataProvider('dataBuildIdentifierWithQuoteSqlSequences')] + public function testBuildIdentifierWithQuoteSqlSequences(string|array $name, string $expected): void + { + $qb = $this->getSharedConnection()->getQueryBuilder(); + + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage( + 'Identifier "' . $expected . '" must not contain sequences processed by ' + . '"Yiisoft\\Db\\Schema\\QuoterInterface::quoteSql()", such as "[[...]]" or "{{...}}".', + ); + $qb->buildExpression(new Identifier($name)); + } } From 9cbde73d1423072f5cf46920701f72fe14df9ad3 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 16 Oct 2026 16:54:22 +0300 Subject: [PATCH 2/2] fix --- tests/QueryBuilderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php index 7e79603f6..e5ce4f7a8 100644 --- a/tests/QueryBuilderTest.php +++ b/tests/QueryBuilderTest.php @@ -714,7 +714,7 @@ public function testBuildIdentifierWithQuoteSqlSequences(string|array $name, str $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'Identifier "' . $expected . '" must not contain sequences processed by ' + 'Identifier ' . $expected . ' must not contain sequences processed by ' . '"Yiisoft\\Db\\Schema\\QuoterInterface::quoteSql()", such as "[[...]]" or "{{...}}".', ); $qb->buildExpression(new Identifier($name));