Tests updates: DB try catch for the ACL test, curl setup fix

curl init alone is not enought to validate a url.

for DB conneciton use try/catch to get errors and skip test
This commit is contained in:
2026-06-25 16:40:10 +09:00
parent d66fce374c
commit e3306a096f
2 changed files with 25 additions and 15 deletions
+21 -15
View File
@@ -80,21 +80,27 @@ final class CoreLibsACLLoginTest extends TestCase
'log_file_id' => 'CoreLibs-ACL-Login-Test', 'log_file_id' => 'CoreLibs-ACL-Login-Test',
]); ]);
// test database we need to connect do, if not possible this test is skipped // test database we need to connect do, if not possible this test is skipped
self::$db = new \CoreLibs\DB\IO( try {
[ self::$db = new \CoreLibs\DB\IO(
'db_name' => $db_name, [
'db_user' => $db_user, 'db_name' => $db_name,
'db_pass' => $db_password, 'db_user' => $db_user,
'db_host' => $db_host, 'db_pass' => $db_password,
'db_port' => 5432, 'db_host' => $db_host,
'db_schema' => 'public', 'db_port' => 5432,
'db_type' => 'pgsql', 'db_schema' => 'public',
'db_encoding' => '', 'db_type' => 'pgsql',
'db_ssl' => 'allow', // allow, disable, require, prefer 'db_encoding' => '',
'db_debug' => true, 'db_ssl' => 'allow', // allow, disable, require, prefer
], 'db_debug' => true,
self::$log ],
); self::$log
);
} catch (\Exception $e) {
self::markTestSkipped(
'Cannot connect to valid Test DB for ACL\Login test: ' . $e->getMessage()
);
}
// ALWAYS drop DB and RECREATE DB // ALWAYS drop DB and RECREATE DB
// dropdb -U corelibs_acl_login_test -h localhost corelibs_acl_login_test // dropdb -U corelibs_acl_login_test -h localhost corelibs_acl_login_test
// createdb -U corelibs_acl_login_test -O corelibs_acl_login_test -E utf8 corelibs_acl_login_test; // createdb -U corelibs_acl_login_test -O corelibs_acl_login_test -E utf8 corelibs_acl_login_test;
@@ -58,6 +58,10 @@ final class CoreLibsUrlRequestsCurlTest extends TestCase
if ($handle === false) { if ($handle === false) {
continue; continue;
} }
$status = curl_exec($handle);
if ($status === false) {
continue;
}
$this->url_basic = $url; $this->url_basic = $url;
// print "Open: $url\n"; // print "Open: $url\n";
break; break;