phpunit tests updates

This commit is contained in:
2023-06-01 09:16:06 +09:00
parent 2c2826ac24
commit c1d26f122e
2 changed files with 16 additions and 8 deletions

View File

@@ -460,16 +460,18 @@ final class CoreLibsDebugSupportTest extends TestCase
* Undocumented function * Undocumented function
* *
* @cover ::getCallerFileLine * @cover ::getCallerFileLine
* @testWith ["/storage/var/www/html/developers/clemens/core_data/php_libraries/trunk/www/vendor/phpunit/phpunit/src/Framework/TestCase.php:1608"] * @testWith ["vendor/phpunit/phpunit/src/Framework/TestCase.php:"]
* @testdox getCallerFileLine check if it returns $expected [$_dataName] * @testdox getCallerFileLine check based on regex /[\w\-\/]/vendor/phpunit/phpunit/src/Framework/TestCase.php:\d+ [$_dataName]
* *
* @param string $expected * @param string $expected
* @return void * @return void
*/ */
public function testGetCallerFileLine(string $expected): void public function testGetCallerFileLine(): void
{ {
$this->assertEquals( // regex prefix with path "/../" and then fixed vendor + \d+
$expected, $regex = "/^\/[\w\-\/]+\/vendor\/phpunit\/phpunit\/src\/Framework\/TestCase.php:\d+$/";
$this->assertMatchesRegularExpression(
$regex,
Support::getCallerFileLine() Support::getCallerFileLine()
); );
} }
@@ -518,11 +520,17 @@ final class CoreLibsDebugSupportTest extends TestCase
break; break;
case 11: case 11:
// add one "run" before "runBare" // add one "run" before "runBare"
// array_splice(
// $expected,
// 7,
// 0,
// ['run']
// );
array_splice( array_splice(
$expected, $expected,
7,
0, 0,
['run'] 0,
['include']
); );
$this->assertEquals( $this->assertEquals(
$expected, $expected,

View File

@@ -20,7 +20,7 @@ final class CoreLibsLoggingLoggingTest extends TestCase
private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR; private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR;
private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date
. "\[[\w\.]+(:\d+)?\]\s{1}" // host:port . "\[[\w\.]+(:\d+)?\]\s{1}" // host:port
. "\[[\w+\.\/]+:\d+\]\s{1}" // folder/file . "\[[\w\-\.\/]+:\d+\]\s{1}" // folder/file
. "\[\w+\]\s{1}" // run id . "\[\w+\]\s{1}" // run id
. "{[\w\\\\]+(::\w+)?}\s{1}"; // class . "{[\w\\\\]+(::\w+)?}\s{1}"; // class