|
16 | 16 | use CodeIgniter\Database\RawSql; |
17 | 17 | use CodeIgniter\Test\CIUnitTestCase; |
18 | 18 | use CodeIgniter\Test\DatabaseTestTrait; |
| 19 | +use PHPUnit\Framework\Attributes\DataProvider; |
19 | 20 | use PHPUnit\Framework\Attributes\Group; |
20 | 21 | use Tests\Support\Database\Seeds\CITestSeeder; |
21 | 22 |
|
@@ -75,17 +76,24 @@ public function testLikeCaseInsensitive(): void |
75 | 76 | $this->assertSame('Developer', $job->name); |
76 | 77 | } |
77 | 78 |
|
78 | | - public function testLikeCaseInsensitiveWithMultibyteCharacter(): void |
| 79 | + #[DataProvider('provideMultibyteCharacters')] |
| 80 | + public function testLikeCaseInsensitiveWithMultibyteCharacter($match, $result): void |
79 | 81 | { |
80 | | - $wai = $this->db->table('without_auto_increment')->like('value', 'ŁĄ', 'both', null, true)->get(); |
| 82 | + $wai = $this->db->table('without_auto_increment')->like('value', $match, 'both', null, true)->get(); |
81 | 83 | $wai = $wai->getRow(); |
82 | 84 |
|
83 | | - $this->assertSame('multibyte characters 1', $wai->key); |
84 | | - |
85 | | - $wai = $this->db->table('without_auto_increment')->like('value', 'خٌوب', 'both', null, true)->get(); |
86 | | - $wai = $wai->getRow(); |
| 85 | + $this->assertSame($result, $wai->key); |
| 86 | + } |
87 | 87 |
|
88 | | - $this->assertSame('multibyte characters 2', $wai->key); |
| 88 | + public static function provideMultibyteCharacters(): iterable |
| 89 | + { |
| 90 | + yield from [ |
| 91 | + 'polish' => ['ŁĄ', 'multibyte characters pl'], |
| 92 | + 'farsi' => ['خٌوب', 'multibyte characters fa'], |
| 93 | + 'bengali' => ['টাইপ', 'multibyte characters bn'], |
| 94 | + 'korean' => ['캐스팅', 'multibyte characters ko'], |
| 95 | + 'malayalam' => ['ടൈപ്പ്', 'multibyte characters ml'], |
| 96 | + ]; |
89 | 97 | } |
90 | 98 |
|
91 | 99 | public function testOrLike(): void |
|
0 commit comments