Skip to content

Commit

Permalink
even more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsn committed Oct 28, 2024
1 parent 79a0cca commit bfe78cc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
16 changes: 14 additions & 2 deletions tests/_support/Database/Seeds/CITestSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
[
Expand Down
22 changes: 15 additions & 7 deletions tests/system/Database/Live/LikeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

public function testLikeCaseInsensitiveWithMultibyteCharacter(): void
#[DataProvider('provideMultibyteCharacters')]

Check failure on line 79 in tests/system/Database/Live/LikeTest.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Method CodeIgniter\Database\Live\LikeTest::testLikeCaseInsensitiveWithMultibyteCharacter() has parameter $match with no type specified.

Check failure on line 79 in tests/system/Database/Live/LikeTest.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Method CodeIgniter\Database\Live\LikeTest::testLikeCaseInsensitiveWithMultibyteCharacter() has parameter $result with no type specified.
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

Check failure on line 88 in tests/system/Database/Live/LikeTest.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Method CodeIgniter\Database\Live\LikeTest::provideMultibyteCharacters() return type has no value type specified in iterable type 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
Expand Down

0 comments on commit bfe78cc

Please sign in to comment.