diff --git a/tests/_support/Database/Seeds/CITestSeeder.php b/tests/_support/Database/Seeds/CITestSeeder.php index fb3e4b033d19..45b70a7fdd19 100644 --- a/tests/_support/Database/Seeds/CITestSeeder.php +++ b/tests/_support/Database/Seeds/CITestSeeder.php @@ -87,13 +87,25 @@ public function run(): void 'value' => 'value', ], [ - 'key' => 'multibyte characters 1', + 'key' => 'multibyte characters pl', 'value' => 'śćźżłąęó', ], [ - 'key' => 'multibyte characters 2', + 'key' => 'multibyte characters fa', 'value' => 'خٌوب', ], + [ + 'key' => 'multibyte characters bn', + 'value' => 'টাইপ', + ], + [ + 'key' => 'multibyte characters ko', + 'value' => '캐스팅', + ], + [ + 'key' => 'multibyte characters ml', + 'value' => 'ടൈപ്പ്', + ], ], 'type_test' => [ [ diff --git a/tests/system/Database/Live/LikeTest.php b/tests/system/Database/Live/LikeTest.php index aa2c57a2ed03..812e1ba42289 100644 --- a/tests/system/Database/Live/LikeTest.php +++ b/tests/system/Database/Live/LikeTest.php @@ -16,6 +16,7 @@ use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; @@ -75,17 +76,24 @@ public function testLikeCaseInsensitive(): void $this->assertSame('Developer', $job->name); } - public function testLikeCaseInsensitiveWithMultibyteCharacter(): void + #[DataProvider('provideMultibyteCharacters')] + public function testLikeCaseInsensitiveWithMultibyteCharacter($match, $result): void { - $wai = $this->db->table('without_auto_increment')->like('value', 'ŁĄ', 'both', null, true)->get(); + $wai = $this->db->table('without_auto_increment')->like('value', $match, 'both', null, true)->get(); $wai = $wai->getRow(); - $this->assertSame('multibyte characters 1', $wai->key); - - $wai = $this->db->table('without_auto_increment')->like('value', 'خٌوب', 'both', null, true)->get(); - $wai = $wai->getRow(); + $this->assertSame($result, $wai->key); + } - $this->assertSame('multibyte characters 2', $wai->key); + public static function provideMultibyteCharacters(): iterable + { + yield from [ + 'polish' => ['ŁĄ', 'multibyte characters pl'], + 'farsi' => ['خٌوب', 'multibyte characters fa'], + 'bengali' => ['টাইপ', 'multibyte characters bn'], + 'korean' => ['캐스팅', 'multibyte characters ko'], + 'malayalam' => ['ടൈപ്പ്', 'multibyte characters ml'], + ]; } public function testOrLike(): void