diff --git a/4dev/tests/CoreLibsDBIOTest.php b/4dev/tests/CoreLibsDBIOTest.php
index 66d77975..cf80906d 100644
--- a/4dev/tests/CoreLibsDBIOTest.php
+++ b/4dev/tests/CoreLibsDBIOTest.php
@@ -2709,7 +2709,8 @@ final class CoreLibsDBIOTest extends TestCase
// comarep all, except timestamp that is a regex
foreach ($expected_history as $key => $value) {
// check if starts with / because this is regex (timestamp)
- if (strpos($value, "/") === 0) {
+ // if (substr($expected_2, 0, 1) == '/) {
+ if (strpos($value, '/') === 0) {
// this is regex
$this->assertMatchesRegularExpression(
$value,
diff --git a/4dev/tests/CoreLibsGetSystemTest.php b/4dev/tests/CoreLibsGetSystemTest.php
index db604309..26ea383a 100644
--- a/4dev/tests/CoreLibsGetSystemTest.php
+++ b/4dev/tests/CoreLibsGetSystemTest.php
@@ -90,11 +90,16 @@ final class CoreLibsGetSystemTest extends TestCase
public function getPageNameProvider(): array
{
return [
+ // 0: input
+ // 1: expected default/WITH_EXTENSION
+ // 2: expected NO_EXTENSION
+ // 3: expected FULL_PATH, if first and last character are / use regex
'original set' => [
- 0 => null, // input
+ 0 => null,
1 => 'phpunit',
2 => 'phpunit',
- 3 => 'www/vendor/bin/phpunit', // NOTE: this can change
+ // NOTE: this can change, so it is a regex check
+ 3 => "/^(\/?.*\/?)?www\/vendor\/bin\/phpunit$/",
],
'some path with extension' => [
0 => '/some/path/to/file.txt',
@@ -147,11 +152,13 @@ final class CoreLibsGetSystemTest extends TestCase
list ($host, $port) = \CoreLibs\Get\System::getHostName();
$this->assertEquals(
$expected_host,
- $host
+ $host,
+ 'failed expected host assert'
);
$this->assertEquals(
$expected_port,
- $port
+ $port,
+ 'faile expected port assert'
);
}
@@ -176,20 +183,38 @@ final class CoreLibsGetSystemTest extends TestCase
// default 0,
$this->assertEquals(
$expected_0,
- \CoreLibs\Get\System::getPageName()
+ \CoreLibs\Get\System::getPageName(),
+ 'failed default assert'
);
$this->assertEquals(
$expected_0,
- \CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::WITH_EXTENSION)
+ \CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::WITH_EXTENSION),
+ 'failed WITH_EXTESION assert'
);
$this->assertEquals(
$expected_1,
- \CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::NO_EXTENSION)
- );
- $this->assertEquals(
- $expected_2,
- \CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::FULL_PATH)
+ \CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::NO_EXTENSION),
+ 'failed NO_EXTENSION assert'
);
+ // FULL PATH check can be equals or regex
+ $page_name_full_path = \CoreLibs\Get\System::getPageName(\CoreLibs\Get\System::FULL_PATH);
+ if (
+ substr($expected_2, 0, 1) == '/' &&
+ substr($expected_2, -1, 1) == '/'
+ ) {
+ // this is regex
+ $this->assertMatchesRegularExpression(
+ $expected_2,
+ $page_name_full_path,
+ 'failed FULL_PATH assert regex'
+ );
+ } else {
+ $this->assertEquals(
+ $expected_2,
+ $page_name_full_path,
+ 'failed FULL_PATH assert equals'
+ );
+ }
}
}
diff --git a/4dev/tests/CoreLibsLanguageL10nTest.php b/4dev/tests/CoreLibsLanguageL10nTest.php
index 1b77751f..fa85cce3 100644
--- a/4dev/tests/CoreLibsLanguageL10nTest.php
+++ b/4dev/tests/CoreLibsLanguageL10nTest.php
@@ -994,10 +994,10 @@ final class CoreLibsLanguageL10nTest extends TestCase
string $translated
): void {
\CoreLibs\Language\L10n::loadFunctions();
- __setlocale(LC_MESSAGES, $locale);
- __textdomain($domain);
- __bindtextdomain($domain, $path);
- __bind_textdomain_codeset($domain, $encoding);
+ _setlocale(LC_MESSAGES, $locale);
+ _textdomain($domain);
+ _bindtextdomain($domain, $path);
+ _bind_textdomain_codeset($domain, $encoding);
$this->assertEquals(
$translated,
__($original),
@@ -1005,7 +1005,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
);
$this->assertEquals(
$translated,
- __gettext($original),
+ _gettext($original),
'function gettext assert failed'
);
}
diff --git a/www/admin/class_test.lang.php b/www/admin/class_test.lang.php
index 9aec8c54..0dd599e8 100644
--- a/www/admin/class_test.lang.php
+++ b/www/admin/class_test.lang.php
@@ -138,6 +138,7 @@ echo "LOAD ERROR: " . $l->getLoadError() . "
";
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "
";
echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "
";
+$lang = 'en';
$domain = 'admin';
echo "
STATIC TYPE TEST
";
// static tests from l10n_load
@@ -154,17 +155,17 @@ echo "
FUNCTIONS
";
// real statisc test
L10n::loadFunctions();
$locale = 'ja';
-__setlocale(LC_MESSAGES, $locale);
-__textdomain($domain);
-__bindtextdomain($domain, $path);
-__bind_textdomain_codeset($domain, $encoding);
+_setlocale(LC_MESSAGES, $locale);
+_textdomain($domain);
+_bindtextdomain($domain, $path);
+_bind_textdomain_codeset($domain, $encoding);
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "
";
$locale = 'en_US.UTF-8';
-__setlocale(LC_MESSAGES, $locale);
-__textdomain($domain);
-__bindtextdomain($domain, $path);
-__bind_textdomain_codeset($domain, $encoding);
+_setlocale(LC_MESSAGES, $locale);
+_textdomain($domain);
+_bindtextdomain($domain, $path);
+_bind_textdomain_codeset($domain, $encoding);
echo "INPUT TEST $locale: " . $string . " => " . __($string) . "
";
print "