Skip to content

Commit bfe78cc

Browse files
committed
even more tests
1 parent 79a0cca commit bfe78cc

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

tests/_support/Database/Seeds/CITestSeeder.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,25 @@ public function run(): void
8787
'value' => 'value',
8888
],
8989
[
90-
'key' => 'multibyte characters 1',
90+
'key' => 'multibyte characters pl',
9191
'value' => 'śćźżłąęó',
9292
],
9393
[
94-
'key' => 'multibyte characters 2',
94+
'key' => 'multibyte characters fa',
9595
'value' => 'خٌوب',
9696
],
97+
[
98+
'key' => 'multibyte characters bn',
99+
'value' => 'টাইপ',
100+
],
101+
[
102+
'key' => 'multibyte characters ko',
103+
'value' => '캐스팅',
104+
],
105+
[
106+
'key' => 'multibyte characters ml',
107+
'value' => 'ടൈപ്പ്',
108+
],
97109
],
98110
'type_test' => [
99111
[

tests/system/Database/Live/LikeTest.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use CodeIgniter\Database\RawSql;
1717
use CodeIgniter\Test\CIUnitTestCase;
1818
use CodeIgniter\Test\DatabaseTestTrait;
19+
use PHPUnit\Framework\Attributes\DataProvider;
1920
use PHPUnit\Framework\Attributes\Group;
2021
use Tests\Support\Database\Seeds\CITestSeeder;
2122

@@ -75,17 +76,24 @@ public function testLikeCaseInsensitive(): void
7576
$this->assertSame('Developer', $job->name);
7677
}
7778

78-
public function testLikeCaseInsensitiveWithMultibyteCharacter(): void
79+
#[DataProvider('provideMultibyteCharacters')]
80+
public function testLikeCaseInsensitiveWithMultibyteCharacter($match, $result): void
7981
{
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();
8183
$wai = $wai->getRow();
8284

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+
}
8787

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+
];
8997
}
9098

9199
public function testOrLike(): void

0 commit comments

Comments
 (0)