Update in DateTime, Uids, support

DateTime::dateStringFormat
Add new flag after show microtime to add microtime with . as a float
type instead of string with ms

Uids creation with alder32 and ripedm160 for 8 and 40 char long uids

Support class with new method getCallerMethodList to return an array of
all methods and not only one point reference
This commit is contained in:
Clemens Schwaighofer
2022-03-01 18:08:41 +09:00
parent aafca0153f
commit cae6d4c372
8 changed files with 113 additions and 19 deletions

View File

@@ -25,26 +25,43 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
'valid timestamp no microtime' => [
1641515890,
false,
false,
'2022-01-07 09:38:10',
],
'valid timestamp with microtime' => [
1641515890,
true,
false,
'2022-01-07 09:38:10',
],
'valid timestamp with microtime float' => [
1641515890,
true,
true,
'2022-01-07 09:38:10',
],
'valid micro timestamp with microtime' => [
1641515890.123456,
true,
false,
'2022-01-07 09:38:10 1235ms',
],
'valid micro timestamp with microtime float' => [
1641515890.123456,
true,
true,
'2022-01-07 09:38:10.1235',
],
'valid micro timestamp no microtime' => [
1641515890.123456,
false,
false,
'2022-01-07 09:38:10',
],
'invalid timestamp' => [
-123123,
false,
false,
'1969-12-30 22:47:57',
],
];
@@ -454,11 +471,19 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
* @param string $expected
* @return void
*/
public function testDateStringFormat($input, bool $flag, string $expected): void
{
public function testDateStringFormat(
$input,
bool $flag_show_micro,
bool $flag_micro_as_float,
string $expected
): void {
$this->assertEquals(
$expected,
\CoreLibs\Combined\DateTime::dateStringFormat($input, $flag)
\CoreLibs\Combined\DateTime::dateStringFormat(
$input,
$flag_show_micro,
$flag_micro_as_float
)
);
}

View File

@@ -24,7 +24,15 @@ final class CoreLibsCreateUidsTest extends TestCase
0 => 'sha256',
1 => 64
],
'default hash DEFAULT_HASH not set' => [
'ripemd160 hash' => [
0 => 'ripemd160',
1 => 40
],
'adler32 hash' => [
0 => 'adler32',
1 => 8
],
'default hash not set' => [
0 => null,
1 => 64,
],

View File

@@ -62,6 +62,11 @@ final class CoreLibsDebugSupportTest extends TestCase
];
}
/**
* Undocumented function
*
* @return array
*/
public function printToStringProvider(): array
{
return [
@@ -246,6 +251,24 @@ final class CoreLibsDebugSupportTest extends TestCase
);
}
/**
* Undocumented function
*
* @cover ::getCallerMethodList
* @testWith [["main", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"]]
* @testdox getCallerMethodList check if it returns $expected [$_dataName]
*
* @param array $expected
* @return void
*/
public function testGetCallerMethodList(array $expected): void
{
$this->assertEquals(
$expected,
\CoreLibs\Debug\Support::getCallerMethodList()
);
}
/**
* Undocumented function
*