From 7e01886ad80d033fd8461965b66e60b2646a3420 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Thu, 25 Jun 2026 15:52:53 +0900 Subject: [PATCH] Test updates: add timezone, some fixes for debug callers --- .../AAASetupData/CoreLibsAAASetupDataTest.php | 5 +++++ .../ACL/CoreLibsACLLogin_database_prepare.sh | 16 +++++++-------- .../Combined/CoreLibsCombinedDateTimeTest.php | 9 +++++---- 4dev/tests/Debug/CoreLibsDebugSupportTest.php | 20 ++++++++++--------- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/4dev/tests/AAASetupData/CoreLibsAAASetupDataTest.php b/4dev/tests/AAASetupData/CoreLibsAAASetupDataTest.php index 625d0059..4200f98a 100644 --- a/4dev/tests/AAASetupData/CoreLibsAAASetupDataTest.php +++ b/4dev/tests/AAASetupData/CoreLibsAAASetupDataTest.php @@ -12,6 +12,8 @@ use PHPUnit\Framework\TestCase; */ final class CoreLibsAAASetupDataTest extends TestCase { + public const TIME_ZONE = 'Asia/Tokyo'; + /** * Covers nothing * @@ -34,6 +36,9 @@ final class CoreLibsAAASetupDataTest extends TestCase BASE, 'BASE Path set check' ); + + // if time zone is not set, errors can happen + ini_set('date.timezone', self::TIME_ZONE); } } diff --git a/4dev/tests/ACL/CoreLibsACLLogin_database_prepare.sh b/4dev/tests/ACL/CoreLibsACLLogin_database_prepare.sh index 34b37a7a..4cb4115d 100755 --- a/4dev/tests/ACL/CoreLibsACLLogin_database_prepare.sh +++ b/4dev/tests/ACL/CoreLibsACLLogin_database_prepare.sh @@ -24,25 +24,25 @@ if [ -z "${db_user}" ] || [ -z "${db_name}" ] || [ -z "${db_host}" ]; then exit 2; fi; # drop database, on error exit with 3 -dropdb -U ${db_user} -h ${db_host} ${db_name} 2>&1; -if [ $? -ne 0 ]; then +dropdb -U "${db_user}" -h "${db_host}" "${db_name}" 2>&1; +if ! $?; then echo 3; exit 3; fi; # create database, on error exit with 4 -createdb -U ${db_user} -O ${db_user} -h ${db_host} -E utf8 ${db_name} 2>&1; -if [ $? -ne 0 ]; then +createdb -U "${db_user}" -O "${db_user}" -h "${db_host}" -E utf8 "${db_name}" 2>&1; +if ! $?; then echo 4; exit 4; fi; # if error 5 thrown, test with enabled below -if [ ! -z "${5}" ]; then - psql -U ${db_user} -h ${db_host} -f ${load_sql} ${db_name}; +if [ -n "${5}" ]; then + psql -U "${db_user}" -h "${db_host}" -f "${load_sql}" "${db_name}"; else # load data (redirect ALL error to null), on error exit with 5 - psql -U ${db_user} -h ${db_host} -f ${load_sql} ${db_name} 2>&1 1>/dev/null 2>/dev/null; + psql -U "${db_user}" -h "${db_host}" -f "${load_sql}" "${db_name}" 2>&1 1>/dev/null 2>/dev/null; fi; -if [ $? -ne 0 ]; then +if ! $?; then echo 5; exit 5; fi; diff --git a/4dev/tests/Combined/CoreLibsCombinedDateTimeTest.php b/4dev/tests/Combined/CoreLibsCombinedDateTimeTest.php index fa54787b..e32baae5 100644 --- a/4dev/tests/Combined/CoreLibsCombinedDateTimeTest.php +++ b/4dev/tests/Combined/CoreLibsCombinedDateTimeTest.php @@ -1,4 +1,4 @@ -assertMatchesRegularExpression( $regex, - Support::getCallerFileLine() + Support::getCallerFileLine(), + 'Failed for: ' . Support::getCallerFileLine() ); } @@ -522,7 +524,7 @@ final class CoreLibsDebugSupportTest extends TestCase $this->assertEquals( $expected, $compare, - 'assert expected 10' + 'assert expected 10: ' . print_r($compare, true) ); break; case 11: @@ -545,7 +547,7 @@ final class CoreLibsDebugSupportTest extends TestCase $this->assertEquals( $expected, $compare, - 'assert expected 11' + 'assert expected 11: ' . print_r($compare, true) ); break; case 12: @@ -565,7 +567,7 @@ final class CoreLibsDebugSupportTest extends TestCase $this->assertEquals( $expected, $compare, - 'assert expected 12' + 'assert expected 12: ' . print_r($compare, true) ); break; default: @@ -589,7 +591,7 @@ final class CoreLibsDebugSupportTest extends TestCase if ($call_stack < 8) { $this->assertFalse(true, 'getCallStack too low: 8'); } else { - $this->assertTrue(true, 'getCallSteck ok'); + $this->assertTrue(true, 'getCallStack ok'); } // just test top entry $first = array_shift($call_stack);