PHP unit tests updates for class changes

This commit is contained in:
Clemens Schwaighofer
2022-12-09 16:53:10 +09:00
parent b7c6d4b478
commit 26af6a07f4
3 changed files with 40 additions and 3 deletions

View File

@@ -16,7 +16,6 @@ use PHPUnit\Framework\TestCase;
*/ */
final class CoreLibsConvertByteTest extends TestCase final class CoreLibsConvertByteTest extends TestCase
{ {
/** /**
* Undocumented function * Undocumented function
* *
@@ -24,7 +23,31 @@ final class CoreLibsConvertByteTest extends TestCase
*/ */
public function byteProvider(): array public function byteProvider(): array
{ {
/*
* 0: input string
* 1: default flags
* 2: BYTE_FORMAT_SI
* 3: BYTE_FORMAT_NOSPACE
* 4: BYTE_FORMAT_ADJUST
* 5: BYTE_FORMAT_SI | BYTE_FORMAT_NOSPACE
*/
return [ return [
'string number' => [
0 => '1024',
1 => '1 KB',
2 => '1.02 KiB',
3 => '1KB',
4 => '1.00 KB',
5 => '1.02KiB',
],
'invalud string number' => [
0 => '1024 MB',
1 => '1024 MB',
2 => '1024 MB',
3 => '1024 MB',
4 => '1024 MB',
5 => '1024 MB',
],
'negative number' => [ 'negative number' => [
0 => -123123123, 0 => -123123123,
1 => '-117.42 MB', 1 => '-117.42 MB',

View File

@@ -113,7 +113,10 @@ final class CoreLibsCreateEmailTest extends TestCase
'日本語カタカナパ', '日本語カタカナパ',
'ISO-2022-JP', 'ISO-2022-JP',
true, true,
'"=?ISO-2022-JP?B?GyRCRnxLXDhsGyhCPz8/Pz8=?=" <test@test.com>' // was ok php 8.1
// '"=?ISO-2022-JP?B?GyRCRnxLXDhsGyhCPz8/Pz8=?=" <test@test.com>'
// below ok php 8.1.12, 2022/12/9
'"=?ISO-2022-JP?B?GyRCRnxLXDhsGyhCPz8/Pz8/?=" <test@test.com>'
] ]
]; ];
} }
@@ -124,6 +127,11 @@ final class CoreLibsCreateEmailTest extends TestCase
* @dataProvider encodeEmailNameProvider * @dataProvider encodeEmailNameProvider
* @testdox encode email $email, name $name, encoding $encoding, folding $kv_folding will be $expected [$_dataName] * @testdox encode email $email, name $name, encoding $encoding, folding $kv_folding will be $expected [$_dataName]
* *
* @param string $email
* @param string|null $name
* @param string|null $encoding
* @param bool|null $kv_folding
* @param string $expected
* @return void * @return void
*/ */
public function testEncodeEmailName( public function testEncodeEmailName(

View File

@@ -1189,7 +1189,13 @@ final class CoreLibsDBIOTest extends TestCase
$this->assertEquals( $this->assertEquals(
$expected, $expected,
$db->dbEscapeBytea($input) $db->dbEscapeBytea($input),
'Assert error to bytea'
);
$this->assertEquals(
$input,
$db->dbUnescapeBytea($expected),
'Assert error from bytes'
); );
$db->dbClose(); $db->dbClose();