diff --git a/4dev/tests/CoreLibsDBIOTest.php b/4dev/tests/CoreLibsDBIOTest.php
index a2354f30..66d77975 100644
--- a/4dev/tests/CoreLibsDBIOTest.php
+++ b/4dev/tests/CoreLibsDBIOTest.php
@@ -347,6 +347,7 @@ final class CoreLibsDBIOTest extends TestCase
/**
* Returns test list for dbCompareVersion check
+ * NOTE: unless we fully mock the =version check needs to be updated
*
* @return array
*/
@@ -357,16 +358,16 @@ final class CoreLibsDBIOTest extends TestCase
return [
'compare = ok' => [ '=13.6.0', true ],
'compare = bad' => [ '=9.2.0', false ],
- 'compare < ok' => [ '<20.0.0', true ],
+ 'compare < ok' => [ '<99.0.0', true ],
'compare < bad' => [ '<9.2.0', false ],
- 'compare <= ok a' => [ '<=20.0.0', true ],
+ 'compare <= ok a' => [ '<=99.0.0', true ],
'compare <= ok b' => [ '<=13.6.0', true ],
'compare <= false' => [ '<=9.2.0', false ],
'compare > ok' => [ '>9.2.0', true ],
- 'compare > bad' => [ '>20.2.0', false ],
+ 'compare > bad' => [ '>99.2.0', false ],
'compare >= ok a' => [ '>=13.6.0', true ],
'compare >= ok b' => [ '>=9.2.0', true ],
- 'compare >= bad' => [ '>=20.0.0', false ],
+ 'compare >= bad' => [ '>=99.0.0', false ],
];
}
diff --git a/www/admin/class_test.admin.backend.php b/www/admin/class_test.admin.backend.php
index 246e999b..cac3c501 100644
--- a/www/admin/class_test.admin.backend.php
+++ b/www/admin/class_test.admin.backend.php
@@ -45,6 +45,7 @@ $log = new CoreLibs\Debug\Logging([
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
$backend = new CoreLibs\Admin\Backend($db, $log);
+print "";
print "
TEST CLASS: ADMIN BACKEND";
print "";
print '';
diff --git a/www/admin/class_test.array.php b/www/admin/class_test.array.php
index b3117940..36e11824 100644
--- a/www/admin/class_test.array.php
+++ b/www/admin/class_test.array.php
@@ -45,6 +45,7 @@ $log = new CoreLibs\Debug\Logging([
// $_array = new CoreLibs\Combined\ArrayHandler();
// $array_class = 'CoreLibs\Combination\ArrayHandler';
+print "";
print "TEST CLASS: ARRAY HANDLER";
print "";
print '';
diff --git a/www/admin/class_test.autoloader.php b/www/admin/class_test.autoloader.php
index 60ae3b52..f600228a 100644
--- a/www/admin/class_test.autoloader.php
+++ b/www/admin/class_test.autoloader.php
@@ -32,6 +32,7 @@ ob_end_flush();
use CoreLibs\Convert\Byte;
+print "";
print "TEST CLASS: AUTOLOADER";
print "";
print '';
diff --git a/www/admin/class_test.byte.php b/www/admin/class_test.byte.php
index 02f58b91..faf3ae9f 100644
--- a/www/admin/class_test.byte.php
+++ b/www/admin/class_test.byte.php
@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$byte_class = 'CoreLibs\Convert\Byte';
+print "";
print "TEST CLASS: BYTE CONVERT";
print "";
print '';
diff --git a/www/admin/class_test.colors.php b/www/admin/class_test.colors.php
index 9811798c..abdaa5f3 100644
--- a/www/admin/class_test.colors.php
+++ b/www/admin/class_test.colors.php
@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$color_class = 'CoreLibs\Convert\Colors';
+print "";
print "TEST CLASS: COLORS";
print "";
print '';
diff --git a/www/admin/class_test.datetime.php b/www/admin/class_test.datetime.php
index 45e11201..93eaf2ac 100644
--- a/www/admin/class_test.datetime.php
+++ b/www/admin/class_test.datetime.php
@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$datetime_class = 'CoreLibs\Combined\DateTime';
+print "";
print "TEST CLASS: DATE/TIME";
print "";
print '';
diff --git a/www/admin/class_test.db.php b/www/admin/class_test.db.php
index b092a298..a4f5a512 100644
--- a/www/admin/class_test.db.php
+++ b/www/admin/class_test.db.php
@@ -39,6 +39,7 @@ $log = new CoreLibs\Debug\Logging([
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
$db->log->debug('START', '=============================>');
+print "";
print "TEST CLASS: DB";
print "";
print '';
diff --git a/www/admin/class_test.debug.php b/www/admin/class_test.debug.php
index a3309f19..418ba77c 100644
--- a/www/admin/class_test.debug.php
+++ b/www/admin/class_test.debug.php
@@ -44,6 +44,7 @@ $debug = new CoreLibs\Debug\Logging([
$debug_support_class = 'CoreLibs\Debug\Support';
$debug_logging_class = 'CoreLibs\Debug\Logging';
+print "";
print "TEST CLASS: DEBUG";
print "";
print '';
diff --git a/www/admin/class_test.email.php b/www/admin/class_test.email.php
index 26e8d433..a5251bad 100644
--- a/www/admin/class_test.email.php
+++ b/www/admin/class_test.email.php
@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
'print_all' => $PRINT_ALL ?? false,
]);
+print "";
print "TEST CLASS: HTML/ELEMENTS";
print "";
print '';
diff --git a/www/admin/class_test.encoding.php b/www/admin/class_test.encoding.php
index 16531222..9f7b654b 100644
--- a/www/admin/class_test.encoding.php
+++ b/www/admin/class_test.encoding.php
@@ -48,6 +48,7 @@ $_chk_enc = new CoreLibs\Check\Encoding();
$_con_enc = new CoreLibs\Convert\Encoding();
$chk_enc = 'CoreLibs\Check\Encoding';
+print "";
print "TEST CLASS: ENCODING (CHECK/CONVERT/MIME)";
print "";
print '';
@@ -64,10 +65,13 @@ $mime_encodes = [
foreach ($mime_encodes as $mime_encode) {
print "__MBMIMEENCODE: $mime_encode[0]: " . MimeEncode::__mbMimeEncode($mime_encode[0], $mime_encode[1]) . "
";
}
+echo "
";
$enc_strings = [
'Normal Text',
'日本語',
+ // bad
+ '❶',
// unworkable
''
];
@@ -77,19 +81,20 @@ $_chk_enc->setErrorChar('∴');
print "ERROR CHAR: " . $_chk_enc->getErrorChar() . "
";
foreach ($enc_strings as $_string) {
$string = $_chk_enc->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
- print "ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "
";
+ print "ENC CHECK: $_string: " . ($string === false ? '-OK-' : print_r($string, true)) . "
";
print "CONV ENCODING: $_string: " . $_con_enc->convertEncoding($_string, 'ISO-2022-JP') . "
";
print "CONV ENCODING (s): $_string: " . $_con_enc->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "
";
print "CONV ENCODING (s,a-false): $_string: "
. $_con_enc->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "
";
}
+echo "
";
// static
// ChkEnc::setErrorChar('∴');
ChkEnc::setErrorChar(0x2234);
print "S::ERROR CHAR: " . ChkEnc::getErrorChar() . "
";
foreach ($enc_strings as $_string) {
$string = ChkEnc::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
- print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "
";
+ print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : print_r($string, true)) . "
";
print "S::CONV ENCODING: $_string: " . ConEnc::convertEncoding($_string, 'ISO-2022-JP') . "
";
print "S::CONV ENCODING (s): $_string: "
. ConEnc::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "
";
diff --git a/www/admin/class_test.file.php b/www/admin/class_test.file.php
index 19e3021e..45f8c7a8 100644
--- a/www/admin/class_test.file.php
+++ b/www/admin/class_test.file.php
@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
'print_all' => $PRINT_ALL ?? false,
]);
+print "";
print "TEST CLASS: FILE";
print "";
print '';
diff --git a/www/admin/class_test.hash.php b/www/admin/class_test.hash.php
index 4d922e83..08cbc27a 100644
--- a/www/admin/class_test.hash.php
+++ b/www/admin/class_test.hash.php
@@ -45,6 +45,7 @@ $hash_class = 'CoreLibs\Create\Hash';
// define a list of from to color sets for conversion test
+print "";
print "TEST CLASS: HASH";
print "";
print '';
diff --git a/www/admin/class_test.html.php b/www/admin/class_test.html.php
index 3c260e64..3f84a96f 100644
--- a/www/admin/class_test.html.php
+++ b/www/admin/class_test.html.php
@@ -49,6 +49,7 @@ $elements_class = 'CoreLibs\Output\Form\Elements';
// define a list of from to color sets for conversion test
+print "";
print "TEST CLASS: HTML/ELEMENTS";
print "";
print '';
diff --git a/www/admin/class_test.image.php b/www/admin/class_test.image.php
index e014b2b2..5dbb2d24 100644
--- a/www/admin/class_test.image.php
+++ b/www/admin/class_test.image.php
@@ -46,6 +46,7 @@ $image_class = 'CoreLibs\Output\Image';
// define a list of from to color sets for conversion test
+print "";
print "TEST CLASS: IMAGE";
print "";
print '';
diff --git a/www/admin/class_test.json.php b/www/admin/class_test.json.php
index 5bc9a752..2755b413 100644
--- a/www/admin/class_test.json.php
+++ b/www/admin/class_test.json.php
@@ -46,6 +46,7 @@ $json_class = 'CoreLibs\Convert\Json';
// define a list of from to color sets for conversion test
+print "";
print "TEST CLASS: JSON";
print "";
print '';
diff --git a/www/admin/class_test.lang.php b/www/admin/class_test.lang.php
index 612c9769..c2b936d2 100644
--- a/www/admin/class_test.lang.php
+++ b/www/admin/class_test.lang.php
@@ -29,28 +29,83 @@ if (!defined('SET_SESSION_NAME')) {
}
// define log file id
$LOG_FILE_ID = 'classTest-lang';
-
-$l = new CoreLibs\Language\L10n($lang);
ob_end_flush();
+print "";
print "TEST CLASS: LANG";
print "";
print '';
+use CoreLibs\Language\L10n;
+
$string = 'INPUT TEST';
-echo "LANGUAGE SET: " . $l->__getLang() . "
";
-echo "LANGUAGE FILE: " . $l->__getMoFile() . "
";
+$l = new CoreLibs\Language\L10n($lang);
+echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "
";
+echo "LANGUAGE FILE: " . $l->getMoFile() . "
";
+echo "LOAD ERROR: " . $l->getLoadError() . "
";
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "
";
// switch to other language
$lang = 'ja_utf8';
$l->l10nReloadMOfile($lang);
-
-echo "LANGUAGE SET: " . $l->__getLang() . "
";
-echo "LANGUAGE FILE: " . $l->__getMoFile() . "
";
+echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "
";
+echo "LANGUAGE FILE: " . $l->getMoFile() . "
";
+echo "LOAD ERROR: " . $l->getLoadError() . "
";
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "
";
-// TODO: run compare check input must match output
+// switch to non existing language
+$lang = 'tr_utf8';
+$l->l10nReloadMOfile($lang);
+echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "
";
+echo "LANGUAGE FILE: " . $l->getMoFile() . "
";
+echo "LOAD ERROR: " . $l->getLoadError() . "
";
+echo "INPUT TEST: " . $string . " => " . $l->__($string) . "
";
+
+echo "
LIST LOCALES
";
+
+$locale = 'en_US.UTF-8';
+$locales = CoreLibs\Language\L10n::listLocales($locale);
+print "[" . $locale . "] LOCALES: " . CoreLibs\Debug\Support::printAr($locales) . "
";
+$locale = 'en.UTF-8';
+$locales = CoreLibs\Language\L10n::listLocales($locale);
+print "[" . $locale . "] LOCALES: " . CoreLibs\Debug\Support::printAr($locales) . "
";
+
+// try to load non existing
+echo "
NEW TYPE
";
+// new path test
+$lang = 'ja';
+$domain = 'admin';
+$encoding = 'UTF-8';
+$path = BASE . INCLUDES . LOCALE;
+$l = new CoreLibs\Language\L10n($lang, $path, $domain, false);
+
+echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "
";
+echo "DOMAIN WANT/SET: " . $domain . '/' . $l->getDomain() . "
";
+echo "LANGUAGE FILE: " . $l->getMoFile() . "
";
+echo "LOAD ERROR: " . $l->getLoadError() . "
";
+echo "INPUT TEST: " . $string . " => " . $l->__($string) . "
";
+echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "
";
+
+
+echo "
STATIC TYPE
";
+// static tests from l10n_load
+L10n::getInstance()->setLocale($lang);
+echo "SET LOCALE: " . L10n::getInstance()->getLocale() . "
";
+L10n::getInstance()->setDomain($domain);
+echo "SET DOMAIN: " . L10n::getInstance()->getDomain() . "
";
+L10n::getInstance()->setTextDomain($domain, $path);
+echo "SET DOMAIN: " . L10n::getInstance()->getTextDomain($domain) . "
";
+// null call __bind_textdomain_codeset
+echo "INPUT TEST: " . $string . " => " . L10n::getInstance()->getTranslator()->gettext($string) . "
";
+
+echo "
FUNCTIONS
";
+// real statisc test
+L10n::loadFunctions();
+__setlocale(LC_MESSAGES, $lang);
+__textdomain($domain);
+__bindtextdomain($domain, $path);
+__bind_textdomain_codeset($domain, $encoding);
+echo "INPUT TEST: " . $string . " => " . __($string) . "
";
print "";
diff --git a/www/admin/class_test.math.php b/www/admin/class_test.math.php
index 388219c6..aa1e904c 100644
--- a/www/admin/class_test.math.php
+++ b/www/admin/class_test.math.php
@@ -44,6 +44,7 @@ $math_class = 'CoreLibs\Convert\Math';
// define a list of from to color sets for conversion test
+print "";
print "TEST CLASS: MATH";
print "";
print '';
diff --git a/www/admin/class_test.mime.php b/www/admin/class_test.mime.php
index 36b28ce3..4ea142fb 100644
--- a/www/admin/class_test.mime.php
+++ b/www/admin/class_test.mime.php
@@ -41,6 +41,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$_mime = new CoreLibs\Convert\MimeAppName();
+print "";
print "TEST CLASS: MIME";
print "";
print '';
diff --git a/www/admin/class_test.output.form.php b/www/admin/class_test.output.form.php
index db86e29b..6361ff8b 100644
--- a/www/admin/class_test.output.form.php
+++ b/www/admin/class_test.output.form.php
@@ -69,6 +69,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log);
+print "";
print "TEST CLASS: FORM GENERATE";
print "";
print '';
diff --git a/www/admin/class_test.password.php b/www/admin/class_test.password.php
index a031a23b..76a0a86b 100644
--- a/www/admin/class_test.password.php
+++ b/www/admin/class_test.password.php
@@ -46,6 +46,7 @@ $password_class = 'CoreLibs\Check\Password';
// define a list of from to color sets for conversion test
+print "";
print "TEST CLASS: PASSWORD";
print "";
print '';
diff --git a/www/admin/class_test.php b/www/admin/class_test.php
index f57698c5..24b27ff9 100644
--- a/www/admin/class_test.php
+++ b/www/admin/class_test.php
@@ -45,6 +45,7 @@ $backend = new CoreLibs\Admin\Backend($db, $log);
$backend->db->dbInfo(true);
ob_end_flush();
+print "";
print "TEST CLASS";
print "";
diff --git a/www/admin/class_test.phpv.php b/www/admin/class_test.phpv.php
index 4b28e531..c323e85f 100644
--- a/www/admin/class_test.phpv.php
+++ b/www/admin/class_test.phpv.php
@@ -46,6 +46,7 @@ $phpv_class = 'CoreLibs\Check\PhpVersion';
// define a list of from to color sets for conversion test
+print "";
print "TEST CLASS: PHP VERSION";
print "";
print '';
diff --git a/www/admin/class_test.randomkey.php b/www/admin/class_test.randomkey.php
index e49a5651..8639b982 100644
--- a/www/admin/class_test.randomkey.php
+++ b/www/admin/class_test.randomkey.php
@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$array_class = 'CoreLibs\Create\RandomKey';
+print "";
print "TEST CLASS: RANDOM KEY";
print "";
print '';
diff --git a/www/admin/class_test.readenvfile.php b/www/admin/class_test.readenvfile.php
index 1bd32f0f..7f4701eb 100644
--- a/www/admin/class_test.readenvfile.php
+++ b/www/admin/class_test.readenvfile.php
@@ -34,6 +34,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$ref_class = 'CoreLibs\Get\ReadEnvFile';
+print "";
print "TEST CLASS: READ ENV FILE";
print "";
print '';
diff --git a/www/admin/class_test.runningtime.php b/www/admin/class_test.runningtime.php
index ac91293d..59e339cd 100644
--- a/www/admin/class_test.runningtime.php
+++ b/www/admin/class_test.runningtime.php
@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
'print_all' => $PRINT_ALL ?? false,
]);
+print "";
print "TEST CLASS: RUNNING IMTE";
print "";
print '';
diff --git a/www/admin/class_test.smarty.php b/www/admin/class_test.smarty.php
index 2d87151e..f1cf2df0 100644
--- a/www/admin/class_test.smarty.php
+++ b/www/admin/class_test.smarty.php
@@ -46,6 +46,7 @@ $log = new CoreLibs\Debug\Logging([
$smarty = new CoreLibs\Template\SmartyExtend();
$l = new CoreLibs\Language\L10n($lang);
+print "";
print "TEST CLASS: SMARTY";
print "";
print '';
diff --git a/www/admin/class_test.system.php b/www/admin/class_test.system.php
index 5bdd8945..bed402f5 100644
--- a/www/admin/class_test.system.php
+++ b/www/admin/class_test.system.php
@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$basic = new CoreLibs\Basic($log);
+print "";
print "TEST CLASS: SYSTEM";
print "";
print '';
diff --git a/www/admin/class_test.token.php b/www/admin/class_test.token.php
index 8932ebea..496e15f2 100644
--- a/www/admin/class_test.token.php
+++ b/www/admin/class_test.token.php
@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
$_token = new CoreLibs\Output\Form\Token();
$token_class = 'CoreLibs\Output\Form\Token';
+print "";
print "TEST CLASS: FORM TOKEN";
print "";
print '';
diff --git a/www/admin/class_test.uids.php b/www/admin/class_test.uids.php
index efb6f948..f50c3586 100644
--- a/www/admin/class_test.uids.php
+++ b/www/admin/class_test.uids.php
@@ -43,6 +43,7 @@ $_uids = new CoreLibs\Create\Uids();
use CoreLibs\Create\Uids;
$uids_class = 'CoreLibs\Create\Uids';
+print "";
print "TEST CLASS: UIDS";
print "";
print '';