Update hash class unit tests, work on DB IO unit tests
This commit is contained in:
@@ -80,7 +80,7 @@ final class CoreLibsCreateHashTest extends TestCase
|
||||
foreach ([null, 'crc32b', 'adler32', 'fnv132', 'fnv1a32', 'joaat'] as $_hash_type) {
|
||||
// default value test
|
||||
if ($_hash_type === null) {
|
||||
$hash_type = 'crc32b';
|
||||
$hash_type = \CoreLibs\Create\Hash::STANDARD_HASH_SHORT;
|
||||
} else {
|
||||
$hash_type = $_hash_type;
|
||||
}
|
||||
@@ -94,6 +94,31 @@ final class CoreLibsCreateHashTest extends TestCase
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hashLongProvider(): array
|
||||
{
|
||||
$hash_source = 'Some String Text';
|
||||
return [
|
||||
'Long Hash check: ' . \CoreLibs\Create\Hash::STANDARD_HASH_LONG => [
|
||||
$hash_source,
|
||||
hash(\CoreLibs\Create\Hash::STANDARD_HASH_LONG, $hash_source)
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function uniqIdLongProvider(): array
|
||||
{
|
||||
return [
|
||||
'uniq id long: ' . \CoreLibs\Create\Hash::STANDARD_HASH_LONG => [
|
||||
strlen(hash(\CoreLibs\Create\Hash::STANDARD_HASH_LONG, 'A'))
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
@@ -172,20 +197,57 @@ final class CoreLibsCreateHashTest extends TestCase
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @covers ::__uniqueID
|
||||
* @covers ::__uniqueId
|
||||
* @testWith [8]
|
||||
* @testdox __uniqId will be length $expected [$_dataName]
|
||||
*
|
||||
* @param integer $expected
|
||||
* @return void
|
||||
*/
|
||||
public function testUniqID(int $expected): void
|
||||
public function testUniqId(int $expected): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
strlen(\CoreLibs\Create\Hash::__uniqId())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @covers ::__hashLong
|
||||
* @dataProvider hashLongProvider
|
||||
* @testdox __hashLong $input will be $expected [$_dataName]
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $expected
|
||||
* @return void
|
||||
*/
|
||||
public function testHashLong(string $input, string $expected): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
\CoreLibs\Create\Hash::__hashLong($input)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @covers ::__uniqueIdLong
|
||||
* @dataProvider uniqIdLongProvider
|
||||
* @testdox __uniqIdLong will be length $expected [$_dataName]
|
||||
*
|
||||
* @param integer $expected
|
||||
* @return void
|
||||
*/
|
||||
public function testUniqIdLong(int $expected): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
strlen(\CoreLibs\Create\Hash::__uniqIdLong())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
|
||||
Reference in New Issue
Block a user