Update phpunit test script and tests

This commit is contained in:
2023-02-24 09:46:03 +09:00
parent 6f653c24a0
commit 9a7399e821
5 changed files with 20 additions and 7 deletions

View File

@@ -1,4 +1,6 @@
base="/storage/var/www/html/developers/clemens/core_data/php_libraries/trunk/"; #!/usr/bin/env bash
base="/storage/var/www/html/developers/clemens/core_data/composer-packages/CoreLibs-Composer-All/";
# -c phpunit.xml # -c phpunit.xml
# --testdox # --testdox
# call with "t" to give verbose testdox output # call with "t" to give verbose testdox output
@@ -31,7 +33,7 @@ if [ ! -z "${2}" ] && [ -z "${php_bin}" ]; then
esac; esac;
fi; fi;
phpunit_call="${php_bin}${base}vendor/bin/phpunit ${opt_testdox} -c ${base}phpunit.xml ${base}4dev/tests/"; phpunit_call="${php_bin}${base}vendor/bin/phpunit ${opt_testdox} -c ${base}phpunit.xml ${base}test/phpunit/";
${phpunit_call}; ${phpunit_call};

View File

@@ -712,12 +712,23 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
*/ */
public function testArrayMergeRecursiveWarningA(): void public function testArrayMergeRecursiveWarningA(): void
{ {
set_error_handler(
static function (int $errno, string $errstr): never {
throw new Exception($errstr, $errno);
},
E_USER_WARNING
);
$arrays = func_get_args(); $arrays = func_get_args();
// first is expected warning // first is expected warning
$warning = array_shift($arrays); $warning = array_shift($arrays);
$this->expectWarning();
$this->expectWarningMessage($warning); // phpunit 10.0 compatible
$this->expectExceptionMessage(($warning));
\CoreLibs\Combined\ArrayHandler::arrayMergeRecursive(...$arrays); \CoreLibs\Combined\ArrayHandler::arrayMergeRecursive(...$arrays);
restore_error_handler();
} }
/** /**

View File

@@ -3456,7 +3456,7 @@ final class CoreLibsDBIOTest extends TestCase
'id' => '51', 'id' => '51',
'error' => 'Max query call needs to be set to at least 1', 'error' => 'Max query call needs to be set to at least 1',
// run:: can be +1 if called in set and not direct // run:: can be +1 if called in set and not direct
'source' => "/^main::run::run::run::run::run::run::(run::)?runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall$/", 'source' => "/^include::main::run::run::run::run::run::run::(run::)?runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall$/",
'pg_error' => '', 'pg_error' => '',
'msg' => '', 'msg' => '',
] ]

View File

@@ -393,7 +393,7 @@ final class CoreLibsDebugSupportTest extends TestCase
* Undocumented function * Undocumented function
* *
* @cover ::getCallerMethodList * @cover ::getCallerMethodList
* @testWith [["main", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"],["main", "run", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"]] * @testWith [["main", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"],["include", "main", "run", "run", "run", "run", "run", "run", "run", "runBare", "runTest", "testGetCallerMethodList"]]
* @testdox getCallerMethodList check if it returns $expected [$_dataName] * @testdox getCallerMethodList check if it returns $expected [$_dataName]
* *
* @param array $expected * @param array $expected

View File

@@ -99,7 +99,7 @@ final class CoreLibsGetSystemTest extends TestCase
1 => 'phpunit', 1 => 'phpunit',
2 => 'phpunit', 2 => 'phpunit',
// NOTE: this can change, so it is a regex check // NOTE: this can change, so it is a regex check
3 => "/^(\/?.*\/?)?www\/vendor\/bin\/phpunit$/", 3 => "/^(\/?.*\/?)?vendor\/bin\/phpunit$/",
], ],
'some path with extension' => [ 'some path with extension' => [
0 => '/some/path/to/file.txt', 0 => '/some/path/to/file.txt',