Add DOCTYPE to all admin test files, update phpunit DB IO test

DB IO Test: Change max DB version to 99 from 20 in Version check test

Add DOCTYPE html to all admin class test files
This commit is contained in:
Clemens Schwaighofer
2022-04-13 10:25:04 +09:00
parent 6f4c5e36e6
commit 556cabca38
30 changed files with 102 additions and 14 deletions

View File

@@ -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 ],
];
}

View File

@@ -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 "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: ADMIN BACKEND</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -45,6 +45,7 @@ $log = new CoreLibs\Debug\Logging([
// $_array = new CoreLibs\Combined\ArrayHandler();
// $array_class = 'CoreLibs\Combination\ArrayHandler';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: ARRAY HANDLER</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -32,6 +32,7 @@ ob_end_flush();
use CoreLibs\Convert\Byte;
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: AUTOLOADER</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$byte_class = 'CoreLibs\Convert\Byte';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: BYTE CONVERT</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$color_class = 'CoreLibs\Convert\Colors';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: COLORS</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$datetime_class = 'CoreLibs\Combined\DateTime';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: DATE/TIME</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -39,6 +39,7 @@ $log = new CoreLibs\Debug\Logging([
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
$db->log->debug('START', '=============================>');
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: DB</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -44,6 +44,7 @@ $debug = new CoreLibs\Debug\Logging([
$debug_support_class = 'CoreLibs\Debug\Support';
$debug_logging_class = 'CoreLibs\Debug\Logging';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: DEBUG</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
'print_all' => $PRINT_ALL ?? false,
]);
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: HTML/ELEMENTS</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -48,6 +48,7 @@ $_chk_enc = new CoreLibs\Check\Encoding();
$_con_enc = new CoreLibs\Convert\Encoding();
$chk_enc = 'CoreLibs\Check\Encoding';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: ENCODING (CHECK/CONVERT/MIME)</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';
@@ -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]) . "<br>";
}
echo "<br>";
$enc_strings = [
'Normal Text',
'日本語',
// bad
'❶',
// unworkable
''
];
@@ -77,19 +81,20 @@ $_chk_enc->setErrorChar('∴');
print "ERROR CHAR: " . $_chk_enc->getErrorChar() . "<br>";
foreach ($enc_strings as $_string) {
$string = $_chk_enc->checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
print "ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
print "ENC CHECK: $_string: " . ($string === false ? '<b>-OK-</b>' : print_r($string, true)) . "<br>";
print "CONV ENCODING: $_string: " . $_con_enc->convertEncoding($_string, 'ISO-2022-JP') . "<br>";
print "CONV ENCODING (s): $_string: " . $_con_enc->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
print "CONV ENCODING (s,a-false): $_string: "
. $_con_enc->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "<br>";
}
echo "<br>";
// static
// ChkEnc::setErrorChar('∴');
ChkEnc::setErrorChar(0x2234);
print "S::ERROR CHAR: " . ChkEnc::getErrorChar() . "<br>";
foreach ($enc_strings as $_string) {
$string = ChkEnc::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
print "S::ENC CHECK: $_string: " . ($string === false ? '<b>-OK-</b>' : print_r($string, true)) . "<br>";
print "S::CONV ENCODING: $_string: " . ConEnc::convertEncoding($_string, 'ISO-2022-JP') . "<br>";
print "S::CONV ENCODING (s): $_string: "
. ConEnc::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";

View File

@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
'print_all' => $PRINT_ALL ?? false,
]);
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: FILE</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -45,6 +45,7 @@ $hash_class = 'CoreLibs\Create\Hash';
// define a list of from to color sets for conversion test
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: HASH</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -49,6 +49,7 @@ $elements_class = 'CoreLibs\Output\Form\Elements';
// define a list of from to color sets for conversion test
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: HTML/ELEMENTS</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -46,6 +46,7 @@ $image_class = 'CoreLibs\Output\Image';
// define a list of from to color sets for conversion test
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: IMAGE</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -46,6 +46,7 @@ $json_class = 'CoreLibs\Convert\Json';
// define a list of from to color sets for conversion test
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: JSON</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -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 "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: LANG</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';
use CoreLibs\Language\L10n;
$string = 'INPUT TEST';
echo "LANGUAGE SET: " . $l->__getLang() . "<br>";
echo "LANGUAGE FILE: " . $l->__getMoFile() . "<br>";
$l = new CoreLibs\Language\L10n($lang);
echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "<br>";
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
// switch to other language
$lang = 'ja_utf8';
$l->l10nReloadMOfile($lang);
echo "LANGUAGE SET: " . $l->__getLang() . "<br>";
echo "LANGUAGE FILE: " . $l->__getMoFile() . "<br>";
echo "LANGUAGE WANT/SET: " . $lang . '/' . $l->getLocale() . "<br>";
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
// 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() . "<br>";
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
echo "<br><b>LIST LOCALES</b><br>";
$locale = 'en_US.UTF-8';
$locales = CoreLibs\Language\L10n::listLocales($locale);
print "[" . $locale . "] LOCALES: " . CoreLibs\Debug\Support::printAr($locales) . "<br>";
$locale = 'en.UTF-8';
$locales = CoreLibs\Language\L10n::listLocales($locale);
print "[" . $locale . "] LOCALES: " . CoreLibs\Debug\Support::printAr($locales) . "<br>";
// try to load non existing
echo "<br><b>NEW TYPE</b><br>";
// 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() . "<br>";
echo "DOMAIN WANT/SET: " . $domain . '/' . $l->getDomain() . "<br>";
echo "LANGUAGE FILE: " . $l->getMoFile() . "<br>";
echo "LOAD ERROR: " . $l->getLoadError() . "<br>";
echo "INPUT TEST: " . $string . " => " . $l->__($string) . "<br>";
echo "TROUGH LOAD: " . $l->getTranslatorClass()->gettext($string) . "<br>";
echo "<br><b>STATIC TYPE</b><br>";
// static tests from l10n_load
L10n::getInstance()->setLocale($lang);
echo "SET LOCALE: " . L10n::getInstance()->getLocale() . "<br>";
L10n::getInstance()->setDomain($domain);
echo "SET DOMAIN: " . L10n::getInstance()->getDomain() . "<br>";
L10n::getInstance()->setTextDomain($domain, $path);
echo "SET DOMAIN: " . L10n::getInstance()->getTextDomain($domain) . "<br>";
// null call __bind_textdomain_codeset
echo "INPUT TEST: " . $string . " => " . L10n::getInstance()->getTranslator()->gettext($string) . "<br>";
echo "<br><b>FUNCTIONS</b><br>";
// real statisc test
L10n::loadFunctions();
__setlocale(LC_MESSAGES, $lang);
__textdomain($domain);
__bindtextdomain($domain, $path);
__bind_textdomain_codeset($domain, $encoding);
echo "INPUT TEST: " . $string . " => " . __($string) . "<br>";
print "</body></html>";

View File

@@ -44,6 +44,7 @@ $math_class = 'CoreLibs\Convert\Math';
// define a list of from to color sets for conversion test
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: MATH</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -41,6 +41,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$_mime = new CoreLibs\Convert\MimeAppName();
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: MIME</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -69,6 +69,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$form = new CoreLibs\Output\Form\Generate(DB_CONFIG, $log);
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: FORM GENERATE</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -46,6 +46,7 @@ $password_class = 'CoreLibs\Check\Password';
// define a list of from to color sets for conversion test
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: PASSWORD</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -45,6 +45,7 @@ $backend = new CoreLibs\Admin\Backend($db, $log);
$backend->db->dbInfo(true);
ob_end_flush();
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS</title><head>";
print "<body>";

View File

@@ -46,6 +46,7 @@ $phpv_class = 'CoreLibs\Check\PhpVersion';
// define a list of from to color sets for conversion test
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: PHP VERSION</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -43,6 +43,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$array_class = 'CoreLibs\Create\RandomKey';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: RANDOM KEY</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -34,6 +34,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$ref_class = 'CoreLibs\Get\ReadEnvFile';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: READ ENV FILE</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
'print_all' => $PRINT_ALL ?? false,
]);
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: RUNNING IMTE</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -46,6 +46,7 @@ $log = new CoreLibs\Debug\Logging([
$smarty = new CoreLibs\Template\SmartyExtend();
$l = new CoreLibs\Language\L10n($lang);
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: SMARTY</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -44,6 +44,7 @@ $log = new CoreLibs\Debug\Logging([
]);
$basic = new CoreLibs\Basic($log);
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: SYSTEM</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -42,6 +42,7 @@ $log = new CoreLibs\Debug\Logging([
$_token = new CoreLibs\Output\Form\Token();
$token_class = 'CoreLibs\Output\Form\Token';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: FORM TOKEN</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';

View File

@@ -43,6 +43,7 @@ $_uids = new CoreLibs\Create\Uids();
use CoreLibs\Create\Uids;
$uids_class = 'CoreLibs\Create\Uids';
print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS: UIDS</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';