Compare commits
54
Commits
v9.8.3
..
545279b9fe
No files matched your search
@@ -1 +1,2 @@
|
|||||||
.libs
|
.libs
|
||||||
|
node_modules/
|
||||||
+8
-8
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phive xmlns="https://phar.io/phive">
|
<phive xmlns="https://phar.io/phive">
|
||||||
<phar name="phpunit" version="^9.6" installed="9.6.13" location="./tools/phpunit" copy="false"/>
|
<phar name="phpunit" version="^9.6" installed="9.6.21" location="./tools/phpunit" copy="false"/>
|
||||||
<phar name="phpcbf" version="^3.7.2" installed="3.7.2" location="./tools/phpcbf" copy="false"/>
|
<phar name="phpcbf" version="^3.7.2" installed="3.10.3" location="./tools/phpcbf" copy="false"/>
|
||||||
<phar name="phpcs" version="^3.7.2" installed="3.7.2" location="./tools/phpcs" copy="false"/>
|
<phar name="phpcs" version="^3.7.2" installed="3.10.3" location="./tools/phpcs" copy="false"/>
|
||||||
<phar name="phpstan" version="^1.10.37" installed="1.10.37" location="./tools/phpstan" copy="false"/>
|
<phar name="phpstan" version="^1.10.37" installed="1.12.4" location="./tools/phpstan" copy="false"/>
|
||||||
<phar name="phan" version="^5.4.2" installed="5.4.2" location="./tools/phan" copy="false"/>
|
<phar name="phan" version="^5.4.2" installed="5.4.3" location="./tools/phan" copy="false"/>
|
||||||
<phar name="psalm" version="^5.15.0" installed="5.15.0" location="./tools/psalm" copy="false"/>
|
<phar name="psalm" version="^5.15.0" installed="5.24.0" location="./tools/psalm" copy="false"/>
|
||||||
<phar name="phpdox" version="^0.12.0" installed="0.12.0" location="./tools/phpdox" copy="false"/>
|
<phar name="phpdox" version="^0.12.0" installed="0.12.0" location="./tools/phpdox" copy="false"/>
|
||||||
<phar name="phpdocumentor" version="^3.4.2" installed="3.4.2" location="./tools/phpDocumentor" copy="false"/>
|
<phar name="phpdocumentor" version="^3.4.2" installed="3.4.3" location="./tools/phpDocumentor" copy="false"/>
|
||||||
<phar name="php-cs-fixer" version="^3.34.1" installed="3.34.1" location="./tools/php-cs-fixer" copy="false"/>
|
<phar name="php-cs-fixer" version="^3.34.1" installed="3.57.2" location="./tools/php-cs-fixer" copy="false"/>
|
||||||
</phive>
|
</phive>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
shell=bash
|
||||||
|
external-sources=true
|
||||||
@@ -1,19 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
BASE_FOLDER=$(dirname $(readlink -f $0))"/";
|
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||||
# Assume script is in 4dev/bin
|
# Assume script is in 4dev/bin
|
||||||
base_folder="${BASE_FOLDER}../../www/";
|
base_folder="${BASE_FOLDER}../../www/";
|
||||||
|
|
||||||
# locale gettext po to mo translator master
|
# locale gettext po to mo translator master
|
||||||
for file in $(ls -1 ${base_folder}../4dev/locale/*.po); do
|
for file in "${base_folder}"../4dev/locale/*.po; do
|
||||||
file=$(basename $file .po);
|
[[ -e "$file" ]] || break
|
||||||
|
file=$(basename "$file" .po);
|
||||||
locale=$(echo "${file}" | cut -d "-" -f 1);
|
locale=$(echo "${file}" | cut -d "-" -f 1);
|
||||||
domain=$(echo "${file}" | cut -d "-" -f 2);
|
domain=$(echo "${file}" | cut -d "-" -f 2);
|
||||||
echo "- Translate language file '${file}' for locale '${locale}' and domain '${domain}':";
|
echo "- Translate language file '${file}' for locale '${locale}' and domain '${domain}':";
|
||||||
if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then
|
if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then
|
||||||
mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/";
|
mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/";
|
||||||
fi;
|
fi;
|
||||||
msgfmt -o ${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo ${base_folder}../4dev/locale/${locale}-${domain}.po;
|
msgfmt -o "${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo" "${base_folder}../4dev/locale/${locale}-${domain}.po";
|
||||||
done;
|
done;
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
+36
-29
@@ -2,16 +2,18 @@
|
|||||||
|
|
||||||
# read source mo files and writes target js files in object form
|
# read source mo files and writes target js files in object form
|
||||||
|
|
||||||
# check for ARG 1 is "mv"
|
# check for ARG 1 is "no-move"
|
||||||
# then move the files directly and don't do manual check (don't create temp files)
|
# then do not move the files directly for manual check
|
||||||
FILE_MOVE=0;
|
FILE_MOVE=1;
|
||||||
if [ "${1}" = "mv" ]; then
|
if [ "${1}" = "no-move" ]; then
|
||||||
|
echo "+++ CREATE TEMPORARY FILES +++";
|
||||||
|
FILE_MOVE=0;
|
||||||
|
else
|
||||||
echo "*** Direct write ***";
|
echo "*** Direct write ***";
|
||||||
FILE_MOVE=1;
|
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
target='';
|
target='';
|
||||||
BASE_FOLDER=$(dirname $(readlink -f $0))"/";
|
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||||
# Assume script is in 4dev/bin
|
# Assume script is in 4dev/bin
|
||||||
base_folder="${BASE_FOLDER}../../www/";
|
base_folder="${BASE_FOLDER}../../www/";
|
||||||
po_folder='../4dev/locale/'
|
po_folder='../4dev/locale/'
|
||||||
@@ -26,9 +28,9 @@ if [ "${target}" == '' ]; then
|
|||||||
echo "*** Non smarty ***";
|
echo "*** Non smarty ***";
|
||||||
TEXTDOMAINDIR=${base_folder}${mo_folder}.
|
TEXTDOMAINDIR=${base_folder}${mo_folder}.
|
||||||
# default is admin
|
# default is admin
|
||||||
TEXTDOMAIN=admin;
|
TEXTDOMAIN="admin";
|
||||||
fi;
|
fi;
|
||||||
js_folder="layout/${TEXTDOMAIN}/javascript/";
|
js_folder="${TEXTDOMAIN}/layout/javascript/";
|
||||||
|
|
||||||
error=0;
|
error=0;
|
||||||
# this checks if the TEXTDOMAIN target actually exists
|
# this checks if the TEXTDOMAIN target actually exists
|
||||||
@@ -44,15 +46,16 @@ if [ ${error} -eq 1 ]; then
|
|||||||
fi;
|
fi;
|
||||||
|
|
||||||
# locale gettext po to mo translator master
|
# locale gettext po to mo translator master
|
||||||
for file in $(ls -1 ${base_folder}../4dev/locale/*.po); do
|
for file in "${base_folder}"../4dev/locale/*.po; do
|
||||||
file=$(basename $file .po);
|
[[ -e "$file" ]] || break
|
||||||
echo "Translate language ${file}";
|
file=$(basename "$file" .po);
|
||||||
locale=$(echo "${file}" | cut -d "-" -f 1);
|
locale=$(echo "${file}" | cut -d "-" -f 1);
|
||||||
domain=$(echo "${file}" | cut -d "-" -f 2);
|
domain=$(echo "${file}" | cut -d "-" -f 2);
|
||||||
|
echo "- Translate language file '${file}' for locale '${locale}' and domain '${domain}':";
|
||||||
if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then
|
if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then
|
||||||
mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/";
|
mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/";
|
||||||
fi;
|
fi;
|
||||||
msgfmt -o ${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo ${base_folder}${po_folder}${locale}-${domain}.po;
|
msgfmt -o "${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo" "${base_folder}${po_folder}${locale}-${domain}.po";
|
||||||
done;
|
done;
|
||||||
|
|
||||||
rx_msgid_empty="^msgid \"\"";
|
rx_msgid_empty="^msgid \"\"";
|
||||||
@@ -62,7 +65,7 @@ rx_msgstr="^msgstr \""
|
|||||||
# quick copy string at the end
|
# quick copy string at the end
|
||||||
quick_copy='';
|
quick_copy='';
|
||||||
|
|
||||||
for language in ${language_list[*]}; do
|
for language in "${language_list[@]}"; do
|
||||||
# I don't know which one must be set, but I think at least LANGUAGE
|
# I don't know which one must be set, but I think at least LANGUAGE
|
||||||
case ${language} in
|
case ${language} in
|
||||||
ja)
|
ja)
|
||||||
@@ -79,7 +82,8 @@ for language in ${language_list[*]}; do
|
|||||||
esac;
|
esac;
|
||||||
# write only one for language and then symlink files
|
# write only one for language and then symlink files
|
||||||
template_file=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##//" | sed -e "s/##LANGUAGE##/${LANG}/");
|
template_file=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##//" | sed -e "s/##LANGUAGE##/${LANG}/");
|
||||||
original_file=$(echo ${template_file} | sed -e 's/\.TMP//g');
|
# original_file=$(echo ${template_file} | sed -e 's/\.TMP//g');
|
||||||
|
original_file=${template_file//.TMP/};
|
||||||
if [ "${FILE_MOVE}" -eq 0 ]; then
|
if [ "${FILE_MOVE}" -eq 0 ]; then
|
||||||
file=${target_folder}${template_file};
|
file=${target_folder}${template_file};
|
||||||
else
|
else
|
||||||
@@ -88,16 +92,18 @@ for language in ${language_list[*]}; do
|
|||||||
echo "===> Write translation file ${file}";
|
echo "===> Write translation file ${file}";
|
||||||
echo ". = normal, : = escape, x = skip";
|
echo ". = normal, : = escape, x = skip";
|
||||||
# init line [aka don't touch this file]
|
# init line [aka don't touch this file]
|
||||||
echo "// AUTO FILL, changes will be overwritten" > $file;
|
echo "// AUTO FILL, changes will be overwritten" > "$file";
|
||||||
echo "// source: ${suffix}, language: ${language}" >> $file;
|
{
|
||||||
echo "// Translation strings in the format" >> $file;
|
echo "// source: ${suffix}, language: ${language}";
|
||||||
echo "// \"Original\":\"Translated\""$'\n' >> $file;
|
echo "// Translation strings in the format";
|
||||||
echo "var i18n = {" >> $file;
|
echo "// \"Original\":\"Translated\""$'\n'
|
||||||
|
echo "var i18n = {"
|
||||||
|
} >> "$file"
|
||||||
# translations stuff
|
# translations stuff
|
||||||
# read the po file
|
# read the po file
|
||||||
pos=0; # do we add a , for the next line
|
pos=0; # do we add a , for the next line
|
||||||
cat "${base_folder}${po_folder}${language}-${TEXTDOMAIN}.po" |
|
cat "${base_folder}${po_folder}${language}-${TEXTDOMAIN}.po" |
|
||||||
while read str; do
|
while read -r str; do
|
||||||
# echo "S: ${str}";
|
# echo "S: ${str}";
|
||||||
# skip empty
|
# skip empty
|
||||||
if [[ "${str}" =~ ${rx_msgid_empty} ]]; then
|
if [[ "${str}" =~ ${rx_msgid_empty} ]]; then
|
||||||
@@ -112,12 +118,13 @@ for language in ${language_list[*]}; do
|
|||||||
str_source=$(echo "${str}" | sed -e "s/^msgid \"//" | sed -e "s/\"$//");
|
str_source=$(echo "${str}" | sed -e "s/^msgid \"//" | sed -e "s/\"$//");
|
||||||
# close right side, if not last add ,
|
# close right side, if not last add ,
|
||||||
if [ "${pos}" -eq 1 ]; then
|
if [ "${pos}" -eq 1 ]; then
|
||||||
echo -n "," >> $file;
|
echo -n "," >> "$file";
|
||||||
fi;
|
fi;
|
||||||
# all " inside string need to be escaped
|
# all " inside string need to be escaped
|
||||||
str_source=$(echo "${str_source}" | sed -e 's/"/\\"/g');
|
# str_source=$(echo "${str_source}" | sed -e 's/"/\\"/g');
|
||||||
|
str_source=${str_source//\"/\\\"}
|
||||||
# fix with proper layout
|
# fix with proper layout
|
||||||
echo -n "\"$str_source\":\"$(TEXTDOMAINDIR=${TEXTDOMAINDIR} LANGUAGE=${language} LANG=${LANG} gettext ${TEXTDOMAIN} "${str_source}")\"" >> $file;
|
echo -n "\"$str_source\":\"$(TEXTDOMAINDIR=${TEXTDOMAINDIR} LANGUAGE=${language} LANG=${LANG} gettext "${TEXTDOMAIN}" "${str_source}")\"" >> "$file";
|
||||||
pos=1;
|
pos=1;
|
||||||
elif [[ "${str}" =~ ${rx_msgstr} ]]; then
|
elif [[ "${str}" =~ ${rx_msgstr} ]]; then
|
||||||
# open right side (ignore)
|
# open right side (ignore)
|
||||||
@@ -128,8 +135,8 @@ for language in ${language_list[*]}; do
|
|||||||
fi;
|
fi;
|
||||||
done;
|
done;
|
||||||
|
|
||||||
echo "" >> $file;
|
echo "" >> "$file";
|
||||||
echo "};" >> $file;
|
echo "};" >> "$file";
|
||||||
echo " [DONE]";
|
echo " [DONE]";
|
||||||
|
|
||||||
# on no move
|
# on no move
|
||||||
@@ -140,19 +147,19 @@ for language in ${language_list[*]}; do
|
|||||||
fi;
|
fi;
|
||||||
|
|
||||||
# symlink to master file
|
# symlink to master file
|
||||||
for suffix in ${source_list[*]}; do
|
for suffix in "${source_list[@]}"; do
|
||||||
# symlink with full lang name
|
# symlink with full lang name
|
||||||
symlink_file[0]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANG}/" | sed -e 's/\.TMP//g');
|
symlink_file[0]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANG}/" | sed -e 's/\.TMP//g');
|
||||||
# create second one with lang (no country) + encoding
|
# create second one with lang (no country) + encoding
|
||||||
symlink_file[1]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANGUAGE}\.${ENCODING}/" | sed -e 's/\.TMP//g');
|
symlink_file[1]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANGUAGE}\.${ENCODING}/" | sed -e 's/\.TMP//g');
|
||||||
for template_file in ${symlink_file[@]}; do
|
for template_file in "${symlink_file[@]}"; do
|
||||||
# if this is not symlink, create them
|
# if this is not symlink, create them
|
||||||
if [ ! -h "${template_file}" ]; then
|
if [ ! -h "${template_file}" ]; then
|
||||||
echo "Create symlink: ${template_file}";
|
echo "Create symlink: ${template_file}";
|
||||||
# symlik to original
|
# symlik to original
|
||||||
cd "${target_folder}";
|
cd "${target_folder}" || exit;
|
||||||
ln -sf "${original_file}" "${template_file}";
|
ln -sf "${original_file}" "${template_file}";
|
||||||
cd - >/dev/null;
|
cd - >/dev/null || exit;
|
||||||
fi;
|
fi;
|
||||||
done;
|
done;
|
||||||
done;
|
done;
|
||||||
|
|||||||
@@ -12,23 +12,25 @@ if [ "${1}" = "t" ] || [ "${2}" = "t" ]; then
|
|||||||
opt_testdox="--testdox";
|
opt_testdox="--testdox";
|
||||||
fi;
|
fi;
|
||||||
php_bin="";
|
php_bin="";
|
||||||
if [ ! -z "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
# "7.3") php_bin="/usr/bin/php7.3 "; ;;
|
# "7.3") php_bin="/usr/bin/php7.3 "; ;;
|
||||||
# "7.4") php_bin="/usr/bin/php7.4 "; ;;
|
# "7.4") php_bin="/usr/bin/php7.4 "; ;;
|
||||||
# "8.0") php_bin="/usr/bin/php8.0 "; ;;
|
# "8.0") php_bin="/usr/bin/php8.0 "; ;;
|
||||||
# "8.1") php_bin="/usr/bin/php8.1 "; ;;
|
# "8.1") php_bin="/usr/bin/php8.1 "; ;;
|
||||||
"8.2") php_bin="/usr/bin/php8.2 "; ;;
|
"8.2") php_bin="/usr/bin/php8.2 "; ;;
|
||||||
|
"8.3") php_bin="/usr/bin/php8.4 "; ;;
|
||||||
*) echo "Not support PHP: ${1}"; exit; ;;
|
*) echo "Not support PHP: ${1}"; exit; ;;
|
||||||
esac;
|
esac;
|
||||||
fi;
|
fi;
|
||||||
if [ ! -z "${2}" ] && [ -z "${php_bin}" ]; then
|
if [ -n "${2}" ] && [ -z "${php_bin}" ]; then
|
||||||
case "${2}" in
|
case "${2}" in
|
||||||
# "7.3") php_bin="/usr/bin/php7.3 "; ;;
|
# "7.3") php_bin="/usr/bin/php7.3 "; ;;
|
||||||
# "7.4") php_bin="/usr/bin/php7.4 "; ;;
|
# "7.4") php_bin="/usr/bin/php7.4 "; ;;
|
||||||
# "8.0") php_bin="/usr/bin/php8.0 "; ;;
|
# "8.0") php_bin="/usr/bin/php8.0 "; ;;
|
||||||
# "8.1") php_bin="/usr/bin/php8.1 "; ;;
|
# "8.1") php_bin="/usr/bin/php8.1 "; ;;
|
||||||
"8.2") php_bin="/usr/bin/php8.2 "; ;;
|
"8.2") php_bin="/usr/bin/php8.2 "; ;;
|
||||||
|
"8.3") php_bin="/usr/bin/php8.3 "; ;;
|
||||||
*) echo "Not support PHP: ${1}"; exit; ;;
|
*) echo "Not support PHP: ${1}"; exit; ;;
|
||||||
esac;
|
esac;
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# DB Query Params ? and : to $
|
||||||
|
|
||||||
|
dbReturn*
|
||||||
|
dbExec
|
||||||
|
|
||||||
|
keep
|
||||||
|
->query
|
||||||
|
->params
|
||||||
|
for reference
|
||||||
|
|
||||||
|
## : named params
|
||||||
|
|
||||||
|
in order for each named found replace with order number:
|
||||||
|
|
||||||
|
```txt
|
||||||
|
:name, :foo, :bar, :name =>
|
||||||
|
$1, $2, $3, $1
|
||||||
|
```
|
||||||
|
|
||||||
|
```php
|
||||||
|
$query = str_replace(
|
||||||
|
[':name', ':foo', ':bar'],
|
||||||
|
['$1', '$2', '$3'],
|
||||||
|
$query
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## ? Params
|
||||||
|
|
||||||
|
Foreach ? set $1 to $n and store that in new params array
|
||||||
|
in QUERY for each ? replace with matching $n
|
||||||
@@ -28,10 +28,10 @@ final class CoreLibsCheckFileTest extends TestCase
|
|||||||
public function filesList(): array
|
public function filesList(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['filename.txt', 'txt', 5],
|
['filename.txt', 'txt', 5, 'text/plain'],
|
||||||
['filename.csv', 'csv', 15],
|
['filename.csv', 'csv', 15, 'text/csv'],
|
||||||
['filename.tsv', 'tsv', 0],
|
['filename.tsv', 'tsv', 0, 'text/plain'],
|
||||||
['file_does_not_exits', '', -1],
|
['file_does_not_exits', '', -1, ''],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +63,15 @@ final class CoreLibsCheckFileTest extends TestCase
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function mimeTypeProvider(): array
|
||||||
|
{
|
||||||
|
$list = [];
|
||||||
|
foreach ($this->filesList() as $row) {
|
||||||
|
$list[$row[0] . ' must be mime type ' . $row[3]] = [$row[0], $row[3]];
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if file extension matches
|
* Tests if file extension matches
|
||||||
*
|
*
|
||||||
@@ -115,6 +124,51 @@ final class CoreLibsCheckFileTest extends TestCase
|
|||||||
unlink($this->base_folder . $input);
|
unlink($this->base_folder . $input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::getMimeType
|
||||||
|
* @dataProvider mimeTypeProvider
|
||||||
|
* @testdox getMimeType $input must be mime type $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input
|
||||||
|
* @param string $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetMimeType(string $input, string $expected): void
|
||||||
|
{
|
||||||
|
if (!empty($expected)) {
|
||||||
|
$file = $this->base_folder . $input;
|
||||||
|
$fp = fopen($file, 'w');
|
||||||
|
switch ($expected) {
|
||||||
|
case 'text/csv':
|
||||||
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
fwrite($fp, '"This is row","' . $expected . '",' . $i . PHP_EOL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'text/tsv':
|
||||||
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
fwrite($fp, "\"This is row\"\t\"" . $expected . "\"\t\"" . $i . PHP_EOL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'text/plain':
|
||||||
|
fwrite($fp, 'This is mime type: ' . $expected . PHP_EOL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
$this->expectException(\UnexpectedValueException::class);
|
||||||
|
}
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Check\File::getMimeType($this->base_folder . $input)
|
||||||
|
);
|
||||||
|
// unlink file
|
||||||
|
if (is_file($this->base_folder . $input)) {
|
||||||
|
unlink($this->base_folder . $input);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -1098,16 +1098,109 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
|
|||||||
* @testdox arrayFlatForKey array $input will be $expected [$_dataName]
|
* @testdox arrayFlatForKey array $input will be $expected [$_dataName]
|
||||||
*
|
*
|
||||||
* @param array $input
|
* @param array $input
|
||||||
|
* @param string $search
|
||||||
* @param array $expected
|
* @param array $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testArrayFlatForKey(array $input, $search, array $expected): void
|
public function testArrayFlatForKey(array $input, string $search, array $expected): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
\CoreLibs\Combined\ArrayHandler::arrayFlatForKey($input, $search)
|
\CoreLibs\Combined\ArrayHandler::arrayFlatForKey($input, $search)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function providerArrayGetNextPrevKey(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'find, ok' => [
|
||||||
|
'input' => [
|
||||||
|
'a' => 'First',
|
||||||
|
'b' => 'Second',
|
||||||
|
'c' => 'Third',
|
||||||
|
],
|
||||||
|
'b',
|
||||||
|
'a',
|
||||||
|
'c'
|
||||||
|
],
|
||||||
|
'find, first' => [
|
||||||
|
'input' => [
|
||||||
|
'a' => 'First',
|
||||||
|
'b' => 'Second',
|
||||||
|
'c' => 'Third',
|
||||||
|
],
|
||||||
|
'a',
|
||||||
|
null,
|
||||||
|
'b'
|
||||||
|
],
|
||||||
|
'find, last' => [
|
||||||
|
'input' => [
|
||||||
|
'a' => 'First',
|
||||||
|
'b' => 'Second',
|
||||||
|
'c' => 'Third',
|
||||||
|
],
|
||||||
|
'c',
|
||||||
|
'b',
|
||||||
|
null
|
||||||
|
],
|
||||||
|
'find, not found' => [
|
||||||
|
'input' => [
|
||||||
|
'a' => 'First',
|
||||||
|
'b' => 'Second',
|
||||||
|
'c' => 'Third',
|
||||||
|
],
|
||||||
|
'z',
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
],
|
||||||
|
'int, index' => [
|
||||||
|
'input' => [
|
||||||
|
'a',
|
||||||
|
'b',
|
||||||
|
'c'
|
||||||
|
],
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::arrayGetPrevKey, ::arrayGetNextKey
|
||||||
|
* @dataProvider providerArrayGetNextPrevKey
|
||||||
|
* @testdox arrayGetNextPrevKey get next/prev key for $search wtih $expected_prev/$expected_next [$_dataName]
|
||||||
|
*
|
||||||
|
* @param array $input
|
||||||
|
* @param int|string $search
|
||||||
|
* @param int|string|null $expected_prev
|
||||||
|
* @param int|string|null $expected_next
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testArrayGetNextPrevKey(
|
||||||
|
array $input,
|
||||||
|
int|string $search,
|
||||||
|
int|string|null $expected_prev,
|
||||||
|
int|string|null $expected_next
|
||||||
|
): void {
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_prev,
|
||||||
|
\CoreLibs\Combined\ArrayHandler::arrayGetPrevKey($input, $search),
|
||||||
|
'Find prev key in array'
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_next,
|
||||||
|
\CoreLibs\Combined\ArrayHandler::arrayGetNextKey($input, $search),
|
||||||
|
'Find next key in array'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -66,6 +66,34 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* date string convert test
|
||||||
|
*
|
||||||
|
* @covers ::dateStringFormat
|
||||||
|
* @dataProvider timestampProvider
|
||||||
|
* @testdox dateStringFormat $input (microtime $flag) will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param int|float $input
|
||||||
|
* @param bool $flag
|
||||||
|
* @param string $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testDateStringFormat(
|
||||||
|
$input,
|
||||||
|
bool $flag_show_micro,
|
||||||
|
bool $flag_micro_as_float,
|
||||||
|
string $expected
|
||||||
|
): void {
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::dateStringFormat(
|
||||||
|
$input,
|
||||||
|
$flag_show_micro,
|
||||||
|
$flag_micro_as_float
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* interval for both directions
|
* interval for both directions
|
||||||
*
|
*
|
||||||
@@ -74,6 +102,11 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
public function intervalProvider(): array
|
public function intervalProvider(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'on hour' => [
|
||||||
|
3600,
|
||||||
|
false,
|
||||||
|
'1h 0m 0s'
|
||||||
|
],
|
||||||
'interval no microtime' => [
|
'interval no microtime' => [
|
||||||
1641515890,
|
1641515890,
|
||||||
false,
|
false,
|
||||||
@@ -82,7 +115,7 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
'interval with microtime' => [
|
'interval with microtime' => [
|
||||||
1641515890,
|
1641515890,
|
||||||
true,
|
true,
|
||||||
'18999d 0h 38m 10s',
|
'18999d 0h 38m 10s 0ms',
|
||||||
],
|
],
|
||||||
'micro interval no microtime' => [
|
'micro interval no microtime' => [
|
||||||
1641515890.123456,
|
1641515890.123456,
|
||||||
@@ -92,7 +125,7 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
'micro interval with microtime' => [
|
'micro interval with microtime' => [
|
||||||
1641515890.123456,
|
1641515890.123456,
|
||||||
true,
|
true,
|
||||||
'18999d 0h 38m 10s 1235ms',
|
'18999d 0h 38m 10s 124ms',
|
||||||
],
|
],
|
||||||
'negative interval no microtime' => [
|
'negative interval no microtime' => [
|
||||||
-1641515890,
|
-1641515890,
|
||||||
@@ -103,27 +136,27 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
'microtime only' => [
|
'microtime only' => [
|
||||||
0.123456,
|
0.123456,
|
||||||
true,
|
true,
|
||||||
'0s 1235ms',
|
'0s 123ms',
|
||||||
],
|
],
|
||||||
'seconds only' => [
|
'seconds only' => [
|
||||||
30.123456,
|
30.123456,
|
||||||
true,
|
true,
|
||||||
'30s 1235ms',
|
'30s 123ms',
|
||||||
],
|
],
|
||||||
'minutes only' => [
|
'minutes only' => [
|
||||||
90.123456,
|
90.123456,
|
||||||
true,
|
true,
|
||||||
'1m 30s 1235ms',
|
'1m 30s 123ms',
|
||||||
],
|
],
|
||||||
'hours only' => [
|
'hours only' => [
|
||||||
3690.123456,
|
3690.123456,
|
||||||
true,
|
true,
|
||||||
'1h 1m 30s 1235ms',
|
'1h 1m 30s 123ms',
|
||||||
],
|
],
|
||||||
'days only' => [
|
'days only' => [
|
||||||
90090.123456,
|
90090.123456,
|
||||||
true,
|
true,
|
||||||
'1d 1h 1m 30s 1235ms',
|
'1d 1h 1m 30s 123ms',
|
||||||
],
|
],
|
||||||
'already set' => [
|
'already set' => [
|
||||||
'1d 1h 1m 30s 1235ms',
|
'1d 1h 1m 30s 1235ms',
|
||||||
@@ -143,6 +176,306 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* time seconds convert test
|
||||||
|
*
|
||||||
|
* @covers ::timeStringFormat
|
||||||
|
* @dataProvider intervalProvider
|
||||||
|
* @testdox timeStringFormat $input (microtime $flag) will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string|int|float $input
|
||||||
|
* @param bool $flag
|
||||||
|
* @param string $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testTimeStringFormat(string|int|float $input, bool $flag, string $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::timeStringFormat($input, $flag)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interval seconds convert
|
||||||
|
*
|
||||||
|
* @covers ::intervalStringFormat
|
||||||
|
* @dataProvider intervalProvider
|
||||||
|
* @testdox intervalStringFormat $input (microtime $show_micro) will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string|int|float $input
|
||||||
|
* @param bool $show_micro
|
||||||
|
* @param string $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testIntervalStringFormat(string|int|float $input, bool $show_micro, string $expected): void
|
||||||
|
{
|
||||||
|
// we skip string input, that is not allowed
|
||||||
|
if (is_string($input)) {
|
||||||
|
$this->assertTrue(true, 'Skip strings');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// invalid values throw exception in default
|
||||||
|
if ($input == 999999999999999) {
|
||||||
|
$this->expectException(\LengthException::class);
|
||||||
|
}
|
||||||
|
// below is equal to timeStringFormat
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::intervalStringFormat(
|
||||||
|
$input,
|
||||||
|
show_microseconds: $show_micro,
|
||||||
|
show_only_days: true,
|
||||||
|
skip_zero: false,
|
||||||
|
skip_last_zero: false,
|
||||||
|
truncate_nanoseconds: true,
|
||||||
|
truncate_zero_seconds_if_microseconds: false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function intervalExtendedProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// A
|
||||||
|
'(60) default value' => [
|
||||||
|
[
|
||||||
|
'seconds' => 60,
|
||||||
|
],
|
||||||
|
'expected' => '1m',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
'(60) default value, skip_last_zero:false' => [
|
||||||
|
[
|
||||||
|
'seconds' => 60,
|
||||||
|
'skip_last_zero' => false,
|
||||||
|
],
|
||||||
|
'expected' => '1m 0s 0ms',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
// B
|
||||||
|
'(120.1) default value' => [
|
||||||
|
[
|
||||||
|
'seconds' => 120.1,
|
||||||
|
],
|
||||||
|
'expected' => '2m 100ms',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
'(120.1) default value, skip_zero:false' => [
|
||||||
|
[
|
||||||
|
'seconds' => 120.1,
|
||||||
|
'skip_zero' => false,
|
||||||
|
],
|
||||||
|
'expected' => '2m 0s 100ms',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
'(120.1) default value, skip_last_zero:false' => [
|
||||||
|
[
|
||||||
|
'seconds' => 120.1,
|
||||||
|
'skip_last_zero' => false,
|
||||||
|
],
|
||||||
|
'expected' => '2m 100ms',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
// C
|
||||||
|
'(3601) default value' => [
|
||||||
|
[
|
||||||
|
'seconds' => 3601,
|
||||||
|
],
|
||||||
|
'expected' => '1h 1s',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
'(3601) default value, skip_zero:false' => [
|
||||||
|
[
|
||||||
|
'seconds' => 3601,
|
||||||
|
'skip_zero' => false,
|
||||||
|
],
|
||||||
|
'expected' => '1h 0m 1s',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
'(3601) default value, skip_last_zero:false' => [
|
||||||
|
[
|
||||||
|
'seconds' => 3601,
|
||||||
|
'skip_last_zero' => false,
|
||||||
|
],
|
||||||
|
'expected' => '1h 1s 0ms',
|
||||||
|
'exception' => null
|
||||||
|
],
|
||||||
|
// TODO create unit tests for ALL edge cases
|
||||||
|
// CREATE abort tests, simple, all others are handled in exception tests
|
||||||
|
'exception: \UnexpectedValueException:1' => [
|
||||||
|
[
|
||||||
|
'seconds' => 99999999999999999999999
|
||||||
|
],
|
||||||
|
'expected' => null,
|
||||||
|
'exception' => [
|
||||||
|
'class' => \UnexpectedValueException::class,
|
||||||
|
'code' => 1,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test all options for interval conversion
|
||||||
|
*
|
||||||
|
* @covers ::intervalStringFormat
|
||||||
|
* @dataProvider intervalExtendedProvider
|
||||||
|
* @testdox intervalStringFormat $input will be $expected / $exception [$_dataName]
|
||||||
|
*
|
||||||
|
* @param array<string,null|int|float|bool> $parameter_list
|
||||||
|
* @param string $expected
|
||||||
|
* @param array<string,mixed> $exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExtendedIntervalStringFormat(
|
||||||
|
array $parameter_list,
|
||||||
|
?string $expected,
|
||||||
|
?array $exception
|
||||||
|
): void {
|
||||||
|
if ($expected === null && $exception === null) {
|
||||||
|
$this->assertFalse(true, 'Cannot have expected and exception null in test data');
|
||||||
|
}
|
||||||
|
$parameters = [];
|
||||||
|
foreach (
|
||||||
|
[
|
||||||
|
'seconds' => null,
|
||||||
|
'truncate_after' => '',
|
||||||
|
'natural_seperator' => false,
|
||||||
|
'name_space_seperator' => false,
|
||||||
|
'show_microseconds' => true,
|
||||||
|
'short_time_name' => true,
|
||||||
|
'skip_last_zero' => true,
|
||||||
|
'skip_zero' => true,
|
||||||
|
'show_only_days' => false,
|
||||||
|
'auto_fix_microseconds' => false,
|
||||||
|
'truncate_nanoseconds' => false,
|
||||||
|
'truncate_zero_seconds_if_microseconds' => true,
|
||||||
|
] as $param => $default
|
||||||
|
) {
|
||||||
|
if (empty($parameter_list[$param]) && $default === null) {
|
||||||
|
$this->assertFalse(true, 'Parameter ' . $param . ' is mandatory ');
|
||||||
|
} elseif (!isset($parameter_list[$param]) || $parameter_list[$param] === null) {
|
||||||
|
$parameters[] = $default;
|
||||||
|
} else {
|
||||||
|
$parameters[] = $parameter_list[$param];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($expected !== null) {
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
call_user_func_array('CoreLibs\Combined\DateTime::intervalStringFormat', $parameters)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (empty($exception['class']) || empty($exception['code'])) {
|
||||||
|
$this->assertFalse(true, 'Exception tests need Exception name and Code');
|
||||||
|
}
|
||||||
|
$this->expectException($exception['class']);
|
||||||
|
$this->expectExceptionCode($exception['code']);
|
||||||
|
// if we have a message, must be regex
|
||||||
|
if (!empty($exception['message'])) {
|
||||||
|
$this->expectExceptionMessageMatches($exception['message']);
|
||||||
|
}
|
||||||
|
call_user_func_array('CoreLibs\Combined\DateTime::intervalStringFormat', $parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array<mixed>
|
||||||
|
*/
|
||||||
|
public function exceptionsIntervalProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'UnexpectedValueException: 1 A' => [
|
||||||
|
'seconds' => 99999999999999999999999,
|
||||||
|
'params' => [],
|
||||||
|
'exception' => \UnexpectedValueException::class,
|
||||||
|
'exception_message' => "/^Seconds value is invalid, too large or more than six decimals: /",
|
||||||
|
'excpetion_code' => 1,
|
||||||
|
],
|
||||||
|
'UnexpectedValueException: 1 B' => [
|
||||||
|
'seconds' => 123.1234567,
|
||||||
|
'params' => [],
|
||||||
|
'exception' => \UnexpectedValueException::class,
|
||||||
|
'exception_message' => "/^Seconds value is invalid, too large or more than six decimals: /",
|
||||||
|
'excpetion_code' => 1,
|
||||||
|
],
|
||||||
|
// exception 2 is very likely covered by exception 1
|
||||||
|
'LengthException: 3' => [
|
||||||
|
'seconds' => 999999999999999999,
|
||||||
|
'params' => [
|
||||||
|
'show_only_days',
|
||||||
|
],
|
||||||
|
'exception' => \LengthException::class,
|
||||||
|
'exception_message' => "/^Input seconds value is too large for days output: /",
|
||||||
|
'excpetion_code' => 3,
|
||||||
|
],
|
||||||
|
'UnexpectedValueException: 4' => [
|
||||||
|
'seconds' => 1234567,
|
||||||
|
'params' => [
|
||||||
|
'truncate_after'
|
||||||
|
],
|
||||||
|
'exception' => \UnexpectedValueException::class,
|
||||||
|
'exception_message' => "/^truncate_after has an invalid value: /",
|
||||||
|
'excpetion_code' => 4,
|
||||||
|
],
|
||||||
|
'UnexpectedValueException: 5' => [
|
||||||
|
'seconds' => 1234567,
|
||||||
|
'params' => [
|
||||||
|
'show_only_days:truncate_after'
|
||||||
|
],
|
||||||
|
'exception' => \UnexpectedValueException::class,
|
||||||
|
'exception_message' =>
|
||||||
|
"/^If show_only_days is turned on, the truncate_after cannot be years or months: /",
|
||||||
|
'excpetion_code' => 5,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test all exceptions
|
||||||
|
*
|
||||||
|
* @covers ::intervalStringFormat
|
||||||
|
* @dataProvider exceptionsIntervalProvider
|
||||||
|
* @testdox intervalStringFormat: test Exceptions
|
||||||
|
*
|
||||||
|
* @param int|float $seconds
|
||||||
|
* @param array<string> $params
|
||||||
|
* @param string $exception
|
||||||
|
* @param string $exception_message
|
||||||
|
* @param int $excpetion_code
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExceptionsIntervalStringFormat(
|
||||||
|
int|float $seconds,
|
||||||
|
array $params,
|
||||||
|
string $exception,
|
||||||
|
string $exception_message,
|
||||||
|
int $excpetion_code,
|
||||||
|
): void {
|
||||||
|
$this->expectException($exception);
|
||||||
|
$this->expectExceptionMessageMatches($exception_message);
|
||||||
|
$this->expectExceptionCode($excpetion_code);
|
||||||
|
if (empty($params)) {
|
||||||
|
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds);
|
||||||
|
} else {
|
||||||
|
if (in_array('show_only_days', $params)) {
|
||||||
|
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds, show_only_days:true);
|
||||||
|
} elseif (in_array('truncate_after', $params)) {
|
||||||
|
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds, truncate_after: 'v');
|
||||||
|
} elseif (in_array('show_only_days:truncate_after', $params)) {
|
||||||
|
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds, show_only_days:true, truncate_after: 'y');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -203,6 +536,25 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::stringToTime
|
||||||
|
* @dataProvider reverseIntervalProvider
|
||||||
|
* @testdox stringToTime $input will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string|int|float $input
|
||||||
|
* @param string|int|float $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testStringToTime($input, $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::stringToTime($input)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -238,6 +590,25 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::checkDate
|
||||||
|
* @dataProvider dateProvider
|
||||||
|
* @testdox checkDate $input will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input
|
||||||
|
* @param bool $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCheckDate(string $input, bool $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::checkDate($input)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -297,6 +668,25 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::checkDateTime
|
||||||
|
* @dataProvider dateTimeProvider
|
||||||
|
* @testdox checkDateTime $input will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input
|
||||||
|
* @param bool $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCheckDateTime(string $input, bool $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::checkDateTime($input)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -371,6 +761,37 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::compareDate
|
||||||
|
* @dataProvider dateCompareProvider
|
||||||
|
* @testdox compareDate $input_a compared to $input_b will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input_a
|
||||||
|
* @param string $input_b
|
||||||
|
* @param int|bool $expected
|
||||||
|
* @param string|null $exception
|
||||||
|
* @param int|null $exception_code
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCompareDate(
|
||||||
|
string $input_a,
|
||||||
|
string $input_b,
|
||||||
|
int|bool $expected,
|
||||||
|
?string $exception,
|
||||||
|
?int $exception_code
|
||||||
|
): void {
|
||||||
|
if ($expected === false) {
|
||||||
|
$this->expectException($exception);
|
||||||
|
$this->expectExceptionCode($exception_code);
|
||||||
|
}
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::compareDate($input_a, $input_b)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -466,6 +887,37 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::compareDateTime
|
||||||
|
* @dataProvider dateTimeCompareProvider
|
||||||
|
* @testdox compareDateTime $input_a compared to $input_b will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input_a
|
||||||
|
* @param string $input_b
|
||||||
|
* @param int|bool $expected
|
||||||
|
* @param string|null $exception
|
||||||
|
* @param int|null $exception_code
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCompareDateTime(
|
||||||
|
string $input_a,
|
||||||
|
string $input_b,
|
||||||
|
int|bool $expected,
|
||||||
|
?string $exception,
|
||||||
|
?int $exception_code
|
||||||
|
): void {
|
||||||
|
if ($expected === false) {
|
||||||
|
$this->expectException($exception);
|
||||||
|
$this->expectExceptionCode($exception_code);
|
||||||
|
}
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Combined\DateTime::compareDateTime($input_a, $input_b)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -520,214 +972,6 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function dateRangeHasWeekendProvider(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'no weekend' => [
|
|
||||||
'2023-07-03',
|
|
||||||
'2023-07-04',
|
|
||||||
false
|
|
||||||
],
|
|
||||||
'start weekend sat' => [
|
|
||||||
'2023-07-01',
|
|
||||||
'2023-07-04',
|
|
||||||
true
|
|
||||||
],
|
|
||||||
'start weekend sun' => [
|
|
||||||
'2023-07-02',
|
|
||||||
'2023-07-04',
|
|
||||||
true
|
|
||||||
],
|
|
||||||
'end weekend sat' => [
|
|
||||||
'2023-07-03',
|
|
||||||
'2023-07-08',
|
|
||||||
true
|
|
||||||
],
|
|
||||||
'end weekend sun' => [
|
|
||||||
'2023-07-03',
|
|
||||||
'2023-07-09',
|
|
||||||
true
|
|
||||||
],
|
|
||||||
'long period > 6 days' => [
|
|
||||||
'2023-07-03',
|
|
||||||
'2023-07-27',
|
|
||||||
true
|
|
||||||
]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* date string convert test
|
|
||||||
*
|
|
||||||
* @covers ::dateStringFormat
|
|
||||||
* @dataProvider timestampProvider
|
|
||||||
* @testdox dateStringFormat $input (microtime $flag) will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @param int|float $input
|
|
||||||
* @param bool $flag
|
|
||||||
* @param string $expected
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testDateStringFormat(
|
|
||||||
$input,
|
|
||||||
bool $flag_show_micro,
|
|
||||||
bool $flag_micro_as_float,
|
|
||||||
string $expected
|
|
||||||
): void {
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
\CoreLibs\Combined\DateTime::dateStringFormat(
|
|
||||||
$input,
|
|
||||||
$flag_show_micro,
|
|
||||||
$flag_micro_as_float
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* interval convert test
|
|
||||||
*
|
|
||||||
* @covers ::timeStringFormat
|
|
||||||
* @dataProvider intervalProvider
|
|
||||||
* @testdox timeStringFormat $input (microtime $flag) will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @param int|float $input
|
|
||||||
* @param bool $flag
|
|
||||||
* @param string $expected
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testTimeStringFormat($input, bool $flag, string $expected): void
|
|
||||||
{
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
\CoreLibs\Combined\DateTime::timeStringFormat($input, $flag)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @covers ::stringToTime
|
|
||||||
* @dataProvider reverseIntervalProvider
|
|
||||||
* @testdox stringToTime $input will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @param string|int|float $input
|
|
||||||
* @param string|int|float $expected
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testStringToTime($input, $expected): void
|
|
||||||
{
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
\CoreLibs\Combined\DateTime::stringToTime($input)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @covers ::checkDate
|
|
||||||
* @dataProvider dateProvider
|
|
||||||
* @testdox checkDate $input will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @param string $input
|
|
||||||
* @param bool $expected
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testCheckDate(string $input, bool $expected): void
|
|
||||||
{
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
\CoreLibs\Combined\DateTime::checkDate($input)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @covers ::checkDateTime
|
|
||||||
* @dataProvider dateTimeProvider
|
|
||||||
* @testdox checkDateTime $input will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @param string $input
|
|
||||||
* @param bool $expected
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testCheckDateTime(string $input, bool $expected): void
|
|
||||||
{
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
\CoreLibs\Combined\DateTime::checkDateTime($input)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @covers ::compareDate
|
|
||||||
* @dataProvider dateCompareProvider
|
|
||||||
* @testdox compareDate $input_a compared to $input_b will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @param string $input_a
|
|
||||||
* @param string $input_b
|
|
||||||
* @param int|bool $expected
|
|
||||||
* @param string|null $exception
|
|
||||||
* @param int|null $exception_code
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testCompareDate(
|
|
||||||
string $input_a,
|
|
||||||
string $input_b,
|
|
||||||
int|bool $expected,
|
|
||||||
?string $exception,
|
|
||||||
?int $exception_code
|
|
||||||
): void {
|
|
||||||
if ($expected === false) {
|
|
||||||
$this->expectException($exception);
|
|
||||||
$this->expectExceptionCode($exception_code);
|
|
||||||
}
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
\CoreLibs\Combined\DateTime::compareDate($input_a, $input_b)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undocumented function
|
|
||||||
*
|
|
||||||
* @covers ::compareDateTime
|
|
||||||
* @dataProvider dateTimeCompareProvider
|
|
||||||
* @testdox compareDateTime $input_a compared to $input_b will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @param string $input_a
|
|
||||||
* @param string $input_b
|
|
||||||
* @param int|bool $expected
|
|
||||||
* @param string|null $exception
|
|
||||||
* @param int|null $exception_code
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testCompareDateTime(
|
|
||||||
string $input_a,
|
|
||||||
string $input_b,
|
|
||||||
int|bool $expected,
|
|
||||||
?string $exception,
|
|
||||||
?int $exception_code
|
|
||||||
): void {
|
|
||||||
if ($expected === false) {
|
|
||||||
$this->expectException($exception);
|
|
||||||
$this->expectExceptionCode($exception_code);
|
|
||||||
}
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
\CoreLibs\Combined\DateTime::compareDateTime($input_a, $input_b)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -906,6 +1150,47 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function dateRangeHasWeekendProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'no weekend' => [
|
||||||
|
'2023-07-03',
|
||||||
|
'2023-07-04',
|
||||||
|
false
|
||||||
|
],
|
||||||
|
'start weekend sat' => [
|
||||||
|
'2023-07-01',
|
||||||
|
'2023-07-04',
|
||||||
|
true
|
||||||
|
],
|
||||||
|
'start weekend sun' => [
|
||||||
|
'2023-07-02',
|
||||||
|
'2023-07-04',
|
||||||
|
true
|
||||||
|
],
|
||||||
|
'end weekend sat' => [
|
||||||
|
'2023-07-03',
|
||||||
|
'2023-07-08',
|
||||||
|
true
|
||||||
|
],
|
||||||
|
'end weekend sun' => [
|
||||||
|
'2023-07-03',
|
||||||
|
'2023-07-09',
|
||||||
|
true
|
||||||
|
],
|
||||||
|
'long period > 6 days' => [
|
||||||
|
'2023-07-03',
|
||||||
|
'2023-07-27',
|
||||||
|
true
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -253,7 +253,8 @@ final class CoreLibsConvertByteTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testHumanReadableByteFormatException(int $flag): void
|
public function testHumanReadableByteFormatException(int $flag): void
|
||||||
{
|
{
|
||||||
$this->expectException(\Exception::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
|
$this->expectExceptionCode(1);
|
||||||
\CoreLibs\Convert\Byte::humanReadableByteFormat(12, $flag);
|
\CoreLibs\Convert\Byte::humanReadableByteFormat(12, $flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +273,8 @@ final class CoreLibsConvertByteTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testStringByteFormatException(int $flag): void
|
public function testStringByteFormatException(int $flag): void
|
||||||
{
|
{
|
||||||
$this->expectException(\Exception::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
|
$this->expectExceptionCode(1);
|
||||||
\CoreLibs\Convert\Byte::stringByteFormat(12, $flag);
|
\CoreLibs\Convert\Byte::stringByteFormat(12, $flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,15 +33,14 @@ final class CoreLibsConvertMimeEncodeTest extends TestCase
|
|||||||
'The quick brown fox jumps over the lazy sheep that sleeps in the ravine '
|
'The quick brown fox jumps over the lazy sheep that sleeps in the ravine '
|
||||||
. 'and has no idea what is going on here',
|
. 'and has no idea what is going on here',
|
||||||
'UTF-8',
|
'UTF-8',
|
||||||
'The quick brown fox jumps over the lazy sheep that sleeps in the ravine '
|
"The quick brown fox jumps over the lazy sheep that sleeps in the ravine and\r\n"
|
||||||
. 'and has no idea what is going on here'
|
. ' has no idea what is going on here'
|
||||||
],
|
],
|
||||||
'standard with special chars UTF-8' => [
|
'standard with special chars UTF-8' => [
|
||||||
'This is ümläßtと漢字もカタカナ!!^$%&',
|
'This is ümläßtと漢字もカタカナ!!^$%&',
|
||||||
'UTF-8',
|
'UTF-8',
|
||||||
'This is =?UTF-8?B?w7xtbMOkw59044Go5ryi5a2X44KC44Kr44K/44Kr44OK77yBIV4k?='
|
"This is =?UTF-8?B?w7xtbMOkw59044Go5ryi5a2X44KC44Kr44K/44Kr44OK77yBIV4k?=\r\n"
|
||||||
. "\r\n"
|
. ' =?UTF-8?B?JSY=?='
|
||||||
. ' =?UTF-8?B?JQ==?=&'
|
|
||||||
],
|
],
|
||||||
'35 chars and space at the end UTF-8' => [
|
'35 chars and space at the end UTF-8' => [
|
||||||
'12345678901234567890123456789012345 '
|
'12345678901234567890123456789012345 '
|
||||||
@@ -62,9 +61,8 @@ final class CoreLibsConvertMimeEncodeTest extends TestCase
|
|||||||
. 'is there a space?',
|
. 'is there a space?',
|
||||||
'UTF-8',
|
'UTF-8',
|
||||||
"=?UTF-8?B?44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr44OK44Kr?=\r\n"
|
"=?UTF-8?B?44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr44OK44Kr?=\r\n"
|
||||||
. " =?UTF-8?B?44K/44Kr44OK?=\r\n"
|
. " =?UTF-8?B?44K/44Kr44OK44GL44Gq44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq?=\r\n"
|
||||||
. " =?UTF-8?B?44GL44Gq44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr?=\r\n"
|
. " =?UTF-8?B?44Kr44K/44Kr44OK44Kr44K/IGlzIHRoZXJlIGEgc3BhY2U/?="
|
||||||
. " =?UTF-8?B?44OK44Kr44K/?= is there a =?UTF-8?B?c3BhY2U/?="
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -85,16 +83,28 @@ final class CoreLibsConvertMimeEncodeTest extends TestCase
|
|||||||
// print "MIME: -" . $encoded . "-\n";
|
// print "MIME: -" . $encoded . "-\n";
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
$encoded
|
$encoded,
|
||||||
|
"__mbMimeEncode"
|
||||||
);
|
);
|
||||||
$decoded = mb_decode_mimeheader($encoded);
|
$decoded = mb_decode_mimeheader($encoded);
|
||||||
// print "INPUT : " . $input . "\n";
|
// print "ENCODED: " . $encoded . "\n";
|
||||||
// print "DECODED: " . $decoded . "\n";
|
// print "INPUT : " . $input . " | " . mb_strlen($input) . "\n";
|
||||||
|
// print "DECODED: " . $decoded . " | " . mb_strlen($decoded) . "\n";
|
||||||
|
// $test_enc = mb_encode_mimeheader($input, $encoding);
|
||||||
|
// $test_dec = mb_decode_mimeheader($test_enc);
|
||||||
|
// print "TEST ENC: " . $test_enc . "\n";
|
||||||
// back compare decoded
|
// back compare decoded
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$input,
|
$input,
|
||||||
$decoded
|
$decoded,
|
||||||
|
"mb_decode_mimeheader"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// $this->assertEquals(
|
||||||
|
// $input,
|
||||||
|
// $test_dec,
|
||||||
|
// 'mb_encode_to_decode'
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ use PHPUnit\Framework\TestCase;
|
|||||||
*/
|
*/
|
||||||
final class CoreLibsConvertStringsTest extends TestCase
|
final class CoreLibsConvertStringsTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private const DATA_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
@@ -256,6 +258,126 @@ final class CoreLibsConvertStringsTest extends TestCase
|
|||||||
$output
|
$output
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provider for testStripMultiplePathSlashes
|
||||||
|
*
|
||||||
|
* @return array<mixed>
|
||||||
|
*/
|
||||||
|
public function stripMultiplePathSlashesProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'no slahses' => [
|
||||||
|
'input' => 'string_abc',
|
||||||
|
'expected' => 'string_abc',
|
||||||
|
],
|
||||||
|
'one slash' => [
|
||||||
|
'input' => 'some/foo',
|
||||||
|
'expected' => 'some/foo',
|
||||||
|
],
|
||||||
|
'two slashes' => [
|
||||||
|
'input' => 'some//foo',
|
||||||
|
'expected' => 'some/foo',
|
||||||
|
],
|
||||||
|
'three slashes' => [
|
||||||
|
'input' => 'some///foo',
|
||||||
|
'expected' => 'some/foo',
|
||||||
|
],
|
||||||
|
'slashes in front' => [
|
||||||
|
'input' => '/foo',
|
||||||
|
'expected' => '/foo',
|
||||||
|
],
|
||||||
|
'two slashes in front' => [
|
||||||
|
'input' => '//foo',
|
||||||
|
'expected' => '/foo',
|
||||||
|
],
|
||||||
|
'thee slashes in front' => [
|
||||||
|
'input' => '///foo',
|
||||||
|
'expected' => '/foo',
|
||||||
|
],
|
||||||
|
'slashes in back' => [
|
||||||
|
'input' => 'foo/',
|
||||||
|
'expected' => 'foo/',
|
||||||
|
],
|
||||||
|
'two slashes in back' => [
|
||||||
|
'input' => 'foo//',
|
||||||
|
'expected' => 'foo/',
|
||||||
|
],
|
||||||
|
'thee slashes in back' => [
|
||||||
|
'input' => 'foo///',
|
||||||
|
'expected' => 'foo/',
|
||||||
|
],
|
||||||
|
'multiple slashes' => [
|
||||||
|
'input' => '/foo//bar///string/end_times',
|
||||||
|
'expected' => '/foo/bar/string/end_times',
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test multiple slashes clean up
|
||||||
|
*
|
||||||
|
* @covers ::stripMultiplePathSlashes
|
||||||
|
* @dataProvider stripMultiplePathSlashesProvider
|
||||||
|
* @testdox stripMultiplePathSlashes $input will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $input
|
||||||
|
* @param string $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testStripMultiplePathSlashes(string $input, string $expected): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Convert\Strings::stripMultiplePathSlashes($input)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function providerStripUTF8BomBytes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"utf8-bom" => [
|
||||||
|
"file" => "UTF8BOM.csv",
|
||||||
|
"expect" => "Asset Type,Epic,File Name\n",
|
||||||
|
],
|
||||||
|
"utf8" => [
|
||||||
|
"file" => "UTF8.csv",
|
||||||
|
"expect" => "Asset Type,Epic,File Name\n",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test utf8 bom remove
|
||||||
|
*
|
||||||
|
* @covers ::stripUTF8BomBytes
|
||||||
|
* @dataProvider providerStripUTF8BomBytes
|
||||||
|
* @testdox stripUTF8BomBytes $file will be $expected [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $file
|
||||||
|
* @param string $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testStripUTF8BomBytes(string $file, string $expected): void
|
||||||
|
{
|
||||||
|
// load sample file
|
||||||
|
if (!is_file(self::DATA_FOLDER . $file)) {
|
||||||
|
$this->markTestSkipped('File: ' . $file . ' could not be opened');
|
||||||
|
}
|
||||||
|
$file = file_get_contents(self::DATA_FOLDER . $file);
|
||||||
|
if ($file === false) {
|
||||||
|
$this->markTestSkipped('File: ' . $file . ' could not be read');
|
||||||
|
}
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
\CoreLibs\Convert\Strings::stripUTF8BomBytes($file)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Asset Type,Epic,File Name
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
Asset Type,Epic,File Name
|
||||||
|
@@ -232,7 +232,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$error,
|
$error,
|
||||||
$last_error,
|
$last_error,
|
||||||
'Assert query warning'
|
'Assert query error'
|
||||||
);
|
);
|
||||||
return [$last_warning, $last_error];
|
return [$last_warning, $last_error];
|
||||||
}
|
}
|
||||||
@@ -251,8 +251,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDbVersion(): void
|
public function testDbVersion(): void
|
||||||
{
|
{
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -276,8 +274,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDbVersionNumeric(): void
|
public function testDbVersionNumeric(): void
|
||||||
{
|
{
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -306,8 +302,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDbVersionInfoParameters(): void
|
public function testDbVersionInfoParameters(): void
|
||||||
{
|
{
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -365,8 +359,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDbVersionInfo(string $parameter, string $expected): void
|
public function testDbVersionInfo(string $parameter, string $expected): void
|
||||||
{
|
{
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -1592,8 +1584,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $error,
|
string $error,
|
||||||
bool $run_many_times = false
|
bool $run_many_times = false
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -1832,8 +1822,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $error,
|
string $error,
|
||||||
string $insert_data
|
string $insert_data
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -2002,8 +1990,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $error,
|
string $error,
|
||||||
string $insert_data
|
string $insert_data
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -3069,8 +3055,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $error,
|
string $error,
|
||||||
string $insert_data
|
string $insert_data
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -3465,7 +3449,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
$read_query,
|
$read_query,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
//
|
// warning: 20
|
||||||
true, '20', '',
|
true, '20', '',
|
||||||
//
|
//
|
||||||
'result', '', '',
|
'result', '', '',
|
||||||
@@ -3482,6 +3466,31 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
'returning_id' => false,
|
'returning_id' => false,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
// prepare with different statement name
|
||||||
|
'prepare query with same statement name, different query' => [
|
||||||
|
'double_error',
|
||||||
|
$read_query,
|
||||||
|
// primary key
|
||||||
|
null,
|
||||||
|
// arguments (none)
|
||||||
|
null,
|
||||||
|
// expected return false, warning: no, error: 26
|
||||||
|
false, '', '26',
|
||||||
|
// return expected, warning, error
|
||||||
|
'', '', '',
|
||||||
|
// dummy query for second prepare with wrong query
|
||||||
|
$read_query . ' WHERE uid = $3',
|
||||||
|
[],
|
||||||
|
//
|
||||||
|
$insert_query,
|
||||||
|
//
|
||||||
|
[
|
||||||
|
'pk_name' => '',
|
||||||
|
'count' => 0,
|
||||||
|
'query' => 'SELECT row_int, uid FROM table_with_primary_key',
|
||||||
|
'returning_id' => false,
|
||||||
|
],
|
||||||
|
],
|
||||||
// insert wrong data count compared to needed (execute 23)
|
// insert wrong data count compared to needed (execute 23)
|
||||||
'wrong parmeter count' => [
|
'wrong parmeter count' => [
|
||||||
'wrong_param_count',
|
'wrong_param_count',
|
||||||
@@ -3554,8 +3563,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $insert_data,
|
string $insert_data,
|
||||||
array $prepare_cursor,
|
array $prepare_cursor,
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -3575,6 +3582,9 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
$db->dbPrepare($stm_name, $query) :
|
$db->dbPrepare($stm_name, $query) :
|
||||||
$db->dbPrepare($stm_name, $query, $pk_name);
|
$db->dbPrepare($stm_name, $query, $pk_name);
|
||||||
}
|
}
|
||||||
|
if ($error_prepare == '26') {
|
||||||
|
$prepare_result = $db->dbPrepare($stm_name, $expected_data_query);
|
||||||
|
}
|
||||||
// if result type, or if forced bool
|
// if result type, or if forced bool
|
||||||
if (is_string($expected_prepare) && $expected_prepare == 'result') {
|
if (is_string($expected_prepare) && $expected_prepare == 'result') {
|
||||||
// if PHP or newer, must be Object PgSql\Result
|
// if PHP or newer, must be Object PgSql\Result
|
||||||
@@ -3597,66 +3607,68 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
|
|
||||||
// for non fail prepare test exec
|
// for non fail prepare test exec
|
||||||
// check test result
|
// check test result
|
||||||
$execute_result = $query_data === null ?
|
if (!$error_prepare) {
|
||||||
$db->dbExecute($stm_name) :
|
$execute_result = $query_data === null ?
|
||||||
$db->dbExecute($stm_name, $query_data);
|
$db->dbExecute($stm_name) :
|
||||||
if ($expected_execute == 'result') {
|
$db->dbExecute($stm_name, $query_data);
|
||||||
// if PHP or newer, must be Object PgSql\Result
|
if ($expected_execute == 'result') {
|
||||||
$this->assertIsObject(
|
// if PHP or newer, must be Object PgSql\Result
|
||||||
$execute_result
|
$this->assertIsObject(
|
||||||
);
|
$execute_result
|
||||||
// also check that this is correct instance type
|
);
|
||||||
$this->assertInstanceOf(
|
// also check that this is correct instance type
|
||||||
'PgSql\Result',
|
$this->assertInstanceOf(
|
||||||
$execute_result
|
'PgSql\Result',
|
||||||
);
|
$execute_result
|
||||||
// if this is an select use dbFetchArray to get data and test
|
);
|
||||||
} else {
|
// if this is an select use dbFetchArray to get data and test
|
||||||
$this->assertEquals(
|
} else {
|
||||||
$expected_execute,
|
$this->assertEquals(
|
||||||
$execute_result
|
$expected_execute,
|
||||||
);
|
$execute_result
|
||||||
}
|
);
|
||||||
// error/warning check
|
}
|
||||||
$this->subAssertErrorTest($db, $warning_execute, $error_execute);
|
// error/warning check
|
||||||
// now check test result if expected return is result
|
$this->subAssertErrorTest($db, $warning_execute, $error_execute);
|
||||||
if (
|
// now check test result if expected return is result
|
||||||
$expected_execute == 'result' &&
|
if (
|
||||||
!empty($expected_data_query)
|
$expected_execute == 'result' &&
|
||||||
) {
|
!empty($expected_data_query)
|
||||||
// $expected_data_query
|
) {
|
||||||
// $expected_data
|
// $expected_data_query
|
||||||
$rows = $db->dbReturnArray($expected_data_query);
|
// $expected_data
|
||||||
$this->assertEquals(
|
$rows = $db->dbReturnArray($expected_data_query);
|
||||||
$expected_data,
|
$this->assertEquals(
|
||||||
$rows
|
$expected_data,
|
||||||
);
|
$rows
|
||||||
}
|
);
|
||||||
if (
|
}
|
||||||
$expected_execute == 'result' &&
|
if (
|
||||||
$execute_result !== false &&
|
$expected_execute == 'result' &&
|
||||||
empty($expected_data_query) &&
|
$execute_result !== false &&
|
||||||
count($expected_data)
|
empty($expected_data_query) &&
|
||||||
) {
|
count($expected_data)
|
||||||
// compare previously read data to compare data
|
) {
|
||||||
$compare_data = [];
|
// compare previously read data to compare data
|
||||||
// read in the query data
|
$compare_data = [];
|
||||||
while (is_array($row = $db->dbFetchArray($execute_result, true))) {
|
// read in the query data
|
||||||
$compare_data[] = $row;
|
while (is_array($row = $db->dbFetchArray($execute_result, true))) {
|
||||||
|
$compare_data[] = $row;
|
||||||
|
}
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_data,
|
||||||
|
$compare_data
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->assertEquals(
|
|
||||||
$expected_data,
|
|
||||||
$compare_data
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check dbGetPrepareCursorValue
|
// check dbGetPrepareCursorValue
|
||||||
foreach (['pk_name', 'count', 'query', 'returning_id'] as $key) {
|
foreach (['pk_name', 'count', 'query', 'returning_id'] as $key) {
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$prepare_cursor[$key],
|
$prepare_cursor[$key],
|
||||||
$db->dbGetPrepareCursorValue($stm_name, $key),
|
$db->dbGetPrepareCursorValue($stm_name, $key),
|
||||||
'Prepared cursor: ' . $key . ': failed assertion'
|
'Prepared cursor: ' . $key . ': failed assertion'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset all data
|
// reset all data
|
||||||
@@ -3844,8 +3856,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $expected_get_var,
|
string $expected_get_var,
|
||||||
string $expected_get_db
|
string $expected_get_db
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config[$connection],
|
self::$db_config[$connection],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -3910,7 +3920,10 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
// 'main::run::run::run::run::run::run::run::runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall
|
// 'main::run::run::run::run::run::run::run::runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall
|
||||||
'source' => "/^(include::)?main::(run::)+runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall$/",
|
'source' => "/^(include::)?main::(run::)+runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall$/",
|
||||||
'pg_error' => '',
|
'pg_error' => '',
|
||||||
'msg' => '',
|
'message' => '',
|
||||||
|
'context' => [
|
||||||
|
'max_calls' => 0
|
||||||
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'trigger warning' => [
|
'trigger warning' => [
|
||||||
@@ -3943,8 +3956,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $error_id,
|
string $error_id,
|
||||||
array $expected_history
|
array $expected_history
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -3970,7 +3981,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
foreach ($expected_history as $key => $value) {
|
foreach ($expected_history as $key => $value) {
|
||||||
// check if starts with / because this is regex (timestamp)
|
// check if starts with / because this is regex (timestamp)
|
||||||
// if (substr($expected_2, 0, 1) == '/) {
|
// if (substr($expected_2, 0, 1) == '/) {
|
||||||
if (strpos($value, '/') === 0) {
|
if (!is_array($value) && strpos($value, '/') === 0) {
|
||||||
// this is regex
|
// this is regex
|
||||||
$this->assertMatchesRegularExpression(
|
$this->assertMatchesRegularExpression(
|
||||||
$value,
|
$value,
|
||||||
@@ -4058,8 +4069,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
bool $expected_set_flag,
|
bool $expected_set_flag,
|
||||||
string $expected_get_encoding
|
string $expected_get_encoding
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config[$connection],
|
self::$db_config[$connection],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -4141,8 +4150,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
?string $encoding_php,
|
?string $encoding_php,
|
||||||
string $text
|
string $text
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config[$connection],
|
self::$db_config[$connection],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -4272,8 +4279,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $table,
|
string $table,
|
||||||
string $primary_key
|
string $primary_key
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -4330,7 +4335,7 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
// NOTE if there are different INSERTS before the primary keys
|
// NOTE if there are different INSERTS before the primary keys
|
||||||
// will not match anymore. Must be updated by hand
|
// will not match anymore. Must be updated by hand
|
||||||
// IMPORTANT: if this is stand alone the primary key will not match and fail
|
// IMPORTANT: if this is stand alone the primary key will not match and fail
|
||||||
$table_with_primary_key_id = 68;
|
$table_with_primary_key_id = 70;
|
||||||
// 0: query + returning
|
// 0: query + returning
|
||||||
// 1: params
|
// 1: params
|
||||||
// 1: pk name for db exec
|
// 1: pk name for db exec
|
||||||
@@ -4530,8 +4535,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
array|string|int|null $expected_ret_ext,
|
array|string|int|null $expected_ret_ext,
|
||||||
array $expected_ret_arr
|
array $expected_ret_arr
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -4875,8 +4878,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
array $expected_col_names,
|
array $expected_col_names,
|
||||||
array $expected_col_types
|
array $expected_col_types
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -5030,6 +5031,147 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
$db->dbClose();
|
$db->dbClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// query placeholder convert
|
||||||
|
|
||||||
|
public function queryPlaceholderReplaceProvider(): array
|
||||||
|
{
|
||||||
|
// WHERE row_varchar = $1
|
||||||
|
return [
|
||||||
|
'select, no change' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
SELECT row_varchar, row_varchar_literal, row_int, row_date
|
||||||
|
FROM table_with_primary_key
|
||||||
|
SQL,
|
||||||
|
'params' => [],
|
||||||
|
'found' => 0,
|
||||||
|
'expected_query' => '',
|
||||||
|
'expected_params' => [],
|
||||||
|
],
|
||||||
|
'select, params ?' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
SELECT row_varchar, row_varchar_literal, row_int, row_date
|
||||||
|
FROM table_with_primary_key
|
||||||
|
WHERE row_varchar = ?
|
||||||
|
SQL,
|
||||||
|
'params' => ['string a'],
|
||||||
|
'found' => 1,
|
||||||
|
'expected_query' => <<<SQL
|
||||||
|
SELECT row_varchar, row_varchar_literal, row_int, row_date
|
||||||
|
FROM table_with_primary_key
|
||||||
|
WHERE row_varchar = $1
|
||||||
|
SQL,
|
||||||
|
'expected_params' => ['string a'],
|
||||||
|
],
|
||||||
|
'select, params :' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
SELECT row_varchar, row_varchar_literal, row_int, row_date
|
||||||
|
FROM table_with_primary_key
|
||||||
|
WHERE row_varchar = :row_varchar
|
||||||
|
SQL,
|
||||||
|
'params' => [':row_varchar' => 'string a'],
|
||||||
|
'found' => 1,
|
||||||
|
'expected_query' => <<<SQL
|
||||||
|
SELECT row_varchar, row_varchar_literal, row_int, row_date
|
||||||
|
FROM table_with_primary_key
|
||||||
|
WHERE row_varchar = $1
|
||||||
|
SQL,
|
||||||
|
'expected_params' => ['string a'],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test query string with placeholders convert
|
||||||
|
*
|
||||||
|
* @dataProvider queryPlaceholderReplaceProvider
|
||||||
|
* @testdox Query replacement test [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $query
|
||||||
|
* @param array $params
|
||||||
|
* @param string $expected_query
|
||||||
|
* @param array $expected_params
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testQueryPlaceholderReplace(
|
||||||
|
string $query,
|
||||||
|
array $params,
|
||||||
|
int $expected_found,
|
||||||
|
string $expected_query,
|
||||||
|
array $expected_params
|
||||||
|
): void {
|
||||||
|
$db = new \CoreLibs\DB\IO(
|
||||||
|
self::$db_config['valid'],
|
||||||
|
self::$log
|
||||||
|
);
|
||||||
|
$db->dbSetConvertPlaceholder(true);
|
||||||
|
//
|
||||||
|
if ($db->dbCheckQueryForSelect($query)) {
|
||||||
|
$res = $db->dbReturnRowParams($query, $params);
|
||||||
|
$converted = $db->dbGetPlaceholderConverted();
|
||||||
|
} else {
|
||||||
|
$db->dbExecParams($query, $params);
|
||||||
|
$converted = $db->dbGetPlaceholderConverted();
|
||||||
|
}
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_found,
|
||||||
|
$converted['found'],
|
||||||
|
'Found not equal'
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_query,
|
||||||
|
$converted['query'],
|
||||||
|
'Query not equal'
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected_params,
|
||||||
|
$converted['params'],
|
||||||
|
'Params not equal'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test exception for placeholder convert
|
||||||
|
* -> internally converted to error
|
||||||
|
*
|
||||||
|
* @testdox Query Replace error tests
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testQueryPlaceholderReplaceException(): void
|
||||||
|
{
|
||||||
|
$db = new \CoreLibs\DB\IO(
|
||||||
|
self::$db_config['valid'],
|
||||||
|
self::$log
|
||||||
|
);
|
||||||
|
$db->dbSetConvertPlaceholder(true);
|
||||||
|
$db->dbExecParams(
|
||||||
|
<<<SQL
|
||||||
|
SELECT foo FROM bar
|
||||||
|
WHERE a = ? and b = :bname
|
||||||
|
SQL,
|
||||||
|
['a', 'b']
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
200,
|
||||||
|
$db->dbGetLastError()
|
||||||
|
);
|
||||||
|
|
||||||
|
// catch unset, for :names
|
||||||
|
$db->dbExecParams(
|
||||||
|
<<<SQL
|
||||||
|
SELECT foo FROM bar
|
||||||
|
WHERE a = :aname and b = :bname
|
||||||
|
SQL,
|
||||||
|
[':foo' => 'a', ':bname' => 'b']
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
210,
|
||||||
|
$db->dbGetLastError()
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: other way around for to pdo
|
||||||
|
}
|
||||||
|
|
||||||
// TODO implement below checks
|
// TODO implement below checks
|
||||||
// - complex write sets
|
// - complex write sets
|
||||||
// dbWriteData, dbWriteDataExt
|
// dbWriteData, dbWriteDataExt
|
||||||
@@ -5158,8 +5300,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
string $warning_final,
|
string $warning_final,
|
||||||
string $error_final
|
string $error_final
|
||||||
): void {
|
): void {
|
||||||
// self::$log->setLogLevelAll('debug', true);
|
|
||||||
// self::$log->setLogLevelAll('print', true);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
public function testGetCallerMethodList(array $expected): void
|
public function testGetCallerMethodList(array $expected): void
|
||||||
{
|
{
|
||||||
$compare = Support::getCallerMethodList();
|
$compare = Support::getCallerMethodList();
|
||||||
// 10: legact
|
// 10: legacy
|
||||||
// 11: direct
|
// 11: direct
|
||||||
// 12: full call
|
// 12: full call
|
||||||
switch (count($compare)) {
|
switch (count($compare)) {
|
||||||
@@ -571,6 +571,31 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @cover ::getCallStack
|
||||||
|
* @testdox getCallStack check if it returns data [$_dataName]
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetCallStack(): void
|
||||||
|
{
|
||||||
|
$call_stack = Support::getCallStack();
|
||||||
|
// print "Get CALL: " . print_r(Support::getCallStack(), true) . "\n";
|
||||||
|
if ($call_stack < 8) {
|
||||||
|
$this->assertFalse(true, 'getCallStack too low: 8');
|
||||||
|
} else {
|
||||||
|
$this->assertTrue(true, 'getCallSteck ok');
|
||||||
|
}
|
||||||
|
// just test top entry
|
||||||
|
$first = array_shift($call_stack);
|
||||||
|
$this->assertStringEndsWith(
|
||||||
|
':tests\CoreLibsDebugSupportTest->testGetCallStack',
|
||||||
|
$first,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the lowest one (one above base)
|
* test the lowest one (one above base)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -216,6 +216,29 @@ final class CoreLibsGetSystemTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @covers ::getIpAddresses
|
||||||
|
* @testdox getIpAddresses check
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetIpAddresses()
|
||||||
|
{
|
||||||
|
// response must have "REMOTE_ADDR" entry, others are optional
|
||||||
|
// NOTE: we have no IP addresses on command line
|
||||||
|
$this->assertTrue(
|
||||||
|
true,
|
||||||
|
"We do not have REMOTE_ADDR on command line"
|
||||||
|
);
|
||||||
|
// $this->assertContains(
|
||||||
|
// 'REMOTE_ADDR',
|
||||||
|
// array_keys(\CoreLibs\Get\System::getIpAddresses()),
|
||||||
|
// 'failed REMOTE_ADDR assert'
|
||||||
|
// );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -39,6 +39,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'OK',
|
'str' => 'OK',
|
||||||
'expected' => 'ok',
|
'expected' => 'ok',
|
||||||
],
|
],
|
||||||
|
'success' => [
|
||||||
|
'level' => 'success',
|
||||||
|
'str' => 'SUCCESS',
|
||||||
|
'expected' => 'success',
|
||||||
|
],
|
||||||
'info' => [
|
'info' => [
|
||||||
'level' => 'info',
|
'level' => 'info',
|
||||||
'str' => 'INFO',
|
'str' => 'INFO',
|
||||||
@@ -225,6 +230,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'ERROR MESSAGE',
|
'str' => 'ERROR MESSAGE',
|
||||||
'message' => null,
|
'message' => null,
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<ERROR> ERROR MESSAGE',
|
'expected' => '<ERROR> ERROR MESSAGE',
|
||||||
],
|
],
|
||||||
'error, logged' => [
|
'error, logged' => [
|
||||||
@@ -233,6 +239,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'ERROR MESSAGE',
|
'str' => 'ERROR MESSAGE',
|
||||||
'message' => null,
|
'message' => null,
|
||||||
'log_error' => true,
|
'log_error' => true,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<ERROR> ERROR MESSAGE',
|
'expected' => '<ERROR> ERROR MESSAGE',
|
||||||
],
|
],
|
||||||
'error, logged, message' => [
|
'error, logged, message' => [
|
||||||
@@ -241,14 +248,43 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'ERROR MESSAGE',
|
'str' => 'ERROR MESSAGE',
|
||||||
'message' => 'OTHER ERROR MESSAGE',
|
'message' => 'OTHER ERROR MESSAGE',
|
||||||
'log_error' => true,
|
'log_error' => true,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<ERROR> OTHER ERROR MESSAGE',
|
'expected' => '<ERROR> OTHER ERROR MESSAGE',
|
||||||
],
|
],
|
||||||
|
'warn, not logged' => [
|
||||||
|
'id' => '300',
|
||||||
|
'level' => 'warn',
|
||||||
|
'str' => 'WARNING MESSAGE',
|
||||||
|
'message' => null,
|
||||||
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
|
'expected' => '<WARNING> WARNING MESSAGE',
|
||||||
|
],
|
||||||
|
'warn, logged' => [
|
||||||
|
'id' => '300',
|
||||||
|
'level' => 'warn',
|
||||||
|
'str' => 'WARNING MESSAGE',
|
||||||
|
'message' => null,
|
||||||
|
'log_error' => null,
|
||||||
|
'log_warning' => true,
|
||||||
|
'expected' => '<WARNING> WARNING MESSAGE',
|
||||||
|
],
|
||||||
|
'warn, logged, message' => [
|
||||||
|
'id' => '300',
|
||||||
|
'level' => 'warn',
|
||||||
|
'str' => 'WARNING MESSAGE',
|
||||||
|
'message' => 'OTHER WARNING MESSAGE',
|
||||||
|
'log_error' => null,
|
||||||
|
'log_warning' => true,
|
||||||
|
'expected' => '<WARNING> OTHER WARNING MESSAGE',
|
||||||
|
],
|
||||||
'notice' => [
|
'notice' => [
|
||||||
'id' => '100',
|
'id' => '100',
|
||||||
'level' => 'notice',
|
'level' => 'notice',
|
||||||
'str' => 'NOTICE MESSAGE',
|
'str' => 'NOTICE MESSAGE',
|
||||||
'message' => null,
|
'message' => null,
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<NOTICE> NOTICE MESSAGE',
|
'expected' => '<NOTICE> NOTICE MESSAGE',
|
||||||
],
|
],
|
||||||
'notice, message' => [
|
'notice, message' => [
|
||||||
@@ -257,6 +293,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'NOTICE MESSAGE',
|
'str' => 'NOTICE MESSAGE',
|
||||||
'message' => 'OTHER NOTICE MESSAGE',
|
'message' => 'OTHER NOTICE MESSAGE',
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<NOTICE> OTHER NOTICE MESSAGE',
|
'expected' => '<NOTICE> OTHER NOTICE MESSAGE',
|
||||||
],
|
],
|
||||||
'crash' => [
|
'crash' => [
|
||||||
@@ -265,6 +302,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'CRASH MESSAGE',
|
'str' => 'CRASH MESSAGE',
|
||||||
'message' => null,
|
'message' => null,
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<ALERT> CRASH MESSAGE',
|
'expected' => '<ALERT> CRASH MESSAGE',
|
||||||
],
|
],
|
||||||
'crash, message' => [
|
'crash, message' => [
|
||||||
@@ -273,6 +311,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'CRASH MESSAGE',
|
'str' => 'CRASH MESSAGE',
|
||||||
'message' => 'OTHER CRASH MESSAGE',
|
'message' => 'OTHER CRASH MESSAGE',
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<ALERT> OTHER CRASH MESSAGE',
|
'expected' => '<ALERT> OTHER CRASH MESSAGE',
|
||||||
],
|
],
|
||||||
'abort' => [
|
'abort' => [
|
||||||
@@ -281,6 +320,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'ABORT MESSAGE',
|
'str' => 'ABORT MESSAGE',
|
||||||
'message' => null,
|
'message' => null,
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<CRITICAL> ABORT MESSAGE',
|
'expected' => '<CRITICAL> ABORT MESSAGE',
|
||||||
],
|
],
|
||||||
'abort, message' => [
|
'abort, message' => [
|
||||||
@@ -289,6 +329,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'ABORT MESSAGE',
|
'str' => 'ABORT MESSAGE',
|
||||||
'message' => 'OTHER ABORT MESSAGE',
|
'message' => 'OTHER ABORT MESSAGE',
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<CRITICAL> OTHER ABORT MESSAGE',
|
'expected' => '<CRITICAL> OTHER ABORT MESSAGE',
|
||||||
],
|
],
|
||||||
'unknown' => [
|
'unknown' => [
|
||||||
@@ -297,6 +338,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'WRONG LEVEL MESSAGE',
|
'str' => 'WRONG LEVEL MESSAGE',
|
||||||
'message' => null,
|
'message' => null,
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<EMERGENCY> WRONG LEVEL MESSAGE',
|
'expected' => '<EMERGENCY> WRONG LEVEL MESSAGE',
|
||||||
],
|
],
|
||||||
'unknown, message' => [
|
'unknown, message' => [
|
||||||
@@ -305,6 +347,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
'str' => 'WRONG LEVEL MESSAGE',
|
'str' => 'WRONG LEVEL MESSAGE',
|
||||||
'message' => 'OTHER WRONG LEVEL MESSAGE',
|
'message' => 'OTHER WRONG LEVEL MESSAGE',
|
||||||
'log_error' => null,
|
'log_error' => null,
|
||||||
|
'log_warning' => null,
|
||||||
'expected' => '<EMERGENCY> OTHER WRONG LEVEL MESSAGE',
|
'expected' => '<EMERGENCY> OTHER WRONG LEVEL MESSAGE',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@@ -321,6 +364,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
* @param string $str
|
* @param string $str
|
||||||
* @param string|null $message
|
* @param string|null $message
|
||||||
* @param bool|null $log_error
|
* @param bool|null $log_error
|
||||||
|
* @param bool|null $log_warning
|
||||||
* @param string $expected
|
* @param string $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -330,6 +374,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
string $str,
|
string $str,
|
||||||
?string $message,
|
?string $message,
|
||||||
?bool $log_error,
|
?bool $log_error,
|
||||||
|
?bool $log_warning,
|
||||||
string $expected
|
string $expected
|
||||||
): void {
|
): void {
|
||||||
$log = new \CoreLibs\Logging\Logging([
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
@@ -344,7 +389,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
$level,
|
$level,
|
||||||
$str,
|
$str,
|
||||||
message: $message,
|
message: $message,
|
||||||
log_error: $log_error
|
log_error: $log_error,
|
||||||
|
log_warning: $log_warning
|
||||||
);
|
);
|
||||||
$file_content = '';
|
$file_content = '';
|
||||||
if (is_file($log->getLogFolder() . $log->getLogFile())) {
|
if (is_file($log->getLogFolder() . $log->getLogFile())) {
|
||||||
@@ -358,6 +404,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
$expected,
|
$expected,
|
||||||
$file_content
|
$file_content
|
||||||
);
|
);
|
||||||
|
} elseif ($level == 'warn' && ($log_warning === null || $log_warning === false)) {
|
||||||
|
$this->assertStringNotContainsString(
|
||||||
|
$expected,
|
||||||
|
$file_content
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->assertStringContainsString(
|
$this->assertStringContainsString(
|
||||||
$expected,
|
$expected,
|
||||||
@@ -377,6 +428,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
* @param string $str
|
* @param string $str
|
||||||
* @param string|null $message
|
* @param string|null $message
|
||||||
* @param bool|null $log_error
|
* @param bool|null $log_error
|
||||||
|
* @param bool|null $log_warning
|
||||||
* @param string $expected
|
* @param string $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -386,6 +438,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
string $str,
|
string $str,
|
||||||
?string $message,
|
?string $message,
|
||||||
?bool $log_error,
|
?bool $log_error,
|
||||||
|
?bool $log_warning,
|
||||||
string $expected
|
string $expected
|
||||||
): void {
|
): void {
|
||||||
$log = new \CoreLibs\Logging\Logging([
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
@@ -400,7 +453,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
$level,
|
$level,
|
||||||
$str,
|
$str,
|
||||||
message: $message,
|
message: $message,
|
||||||
log_error: $log_error
|
log_error: $log_error,
|
||||||
|
log_warning: $log_warning
|
||||||
);
|
);
|
||||||
$file_content = '';
|
$file_content = '';
|
||||||
if (is_file($log->getLogFolder() . $log->getLogFile())) {
|
if (is_file($log->getLogFolder() . $log->getLogFile())) {
|
||||||
@@ -414,6 +468,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
$expected,
|
$expected,
|
||||||
$file_content
|
$file_content
|
||||||
);
|
);
|
||||||
|
} elseif ($level == 'warn' && $log_warning === false) {
|
||||||
|
$this->assertStringNotContainsString(
|
||||||
|
$expected,
|
||||||
|
$file_content
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->assertStringContainsString(
|
$this->assertStringContainsString(
|
||||||
$expected,
|
$expected,
|
||||||
|
|||||||
@@ -46,12 +46,34 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
|
|||||||
public function testEncryptDecryptSuccess(string $input, string $expected): void
|
public function testEncryptDecryptSuccess(string $input, string $expected): void
|
||||||
{
|
{
|
||||||
$key = CreateKey::generateRandomKey();
|
$key = CreateKey::generateRandomKey();
|
||||||
$encrypted = SymmetricEncryption::encrypt($input, $key);
|
|
||||||
$decrypted = SymmetricEncryption::decrypt($encrypted, $key);
|
// test class
|
||||||
|
$crypt = new SymmetricEncryption($key);
|
||||||
|
$encrypted = $crypt->encrypt($input);
|
||||||
|
$decrypted = $crypt->decrypt($encrypted);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
$decrypted,
|
||||||
|
'Class call',
|
||||||
|
);
|
||||||
|
|
||||||
|
// test indirect
|
||||||
|
$encrypted = SymmetricEncryption::getInstance($key)->encrypt($input);
|
||||||
|
$decrypted = SymmetricEncryption::getInstance($key)->decrypt($encrypted);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
$decrypted,
|
||||||
|
'Class Instance call',
|
||||||
|
);
|
||||||
|
|
||||||
|
// test static
|
||||||
|
$encrypted = SymmetricEncryption::encryptKey($input, $key);
|
||||||
|
$decrypted = SymmetricEncryption::decryptKey($encrypted, $key);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
$decrypted
|
$decrypted,
|
||||||
|
'Static call',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,10 +108,24 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
|
|||||||
public function testEncryptFailed(string $input, string $exception_message): void
|
public function testEncryptFailed(string $input, string $exception_message): void
|
||||||
{
|
{
|
||||||
$key = CreateKey::generateRandomKey();
|
$key = CreateKey::generateRandomKey();
|
||||||
$encrypted = SymmetricEncryption::encrypt($input, $key);
|
|
||||||
$wrong_key = CreateKey::generateRandomKey();
|
$wrong_key = CreateKey::generateRandomKey();
|
||||||
|
|
||||||
|
// wrong key in class call
|
||||||
|
$crypt = new SymmetricEncryption($key);
|
||||||
|
$encrypted = $crypt->encrypt($input);
|
||||||
$this->expectExceptionMessage($exception_message);
|
$this->expectExceptionMessage($exception_message);
|
||||||
SymmetricEncryption::decrypt($encrypted, $wrong_key);
|
$crypt->setKey($key);
|
||||||
|
$crypt->decrypt($encrypted);
|
||||||
|
|
||||||
|
// class instance
|
||||||
|
$encrypted = SymmetricEncryption::getInstance($key)->encrypt($input);
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::getInstance($wrong_key)->decrypt($encrypted);
|
||||||
|
|
||||||
|
// class static
|
||||||
|
$encrypted = SymmetricEncryption::encryptKey($input, $key);
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::decryptKey($encrypted, $wrong_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +143,6 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
|
|||||||
'too short hex key' => [
|
'too short hex key' => [
|
||||||
'key' => '1cabd5cba9e042f12522f4ff2de5c31d233b',
|
'key' => '1cabd5cba9e042f12522f4ff2de5c31d233b',
|
||||||
'excpetion_message' => 'Key is not the correct size (must be '
|
'excpetion_message' => 'Key is not the correct size (must be '
|
||||||
. 'SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes long).'
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -126,13 +161,33 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testWrongKey(string $key, string $exception_message): void
|
public function testWrongKey(string $key, string $exception_message): void
|
||||||
{
|
{
|
||||||
$this->expectExceptionMessage($exception_message);
|
|
||||||
SymmetricEncryption::encrypt('test', $key);
|
|
||||||
// we must encrypt valid thing first so we can fail with the wrong kjey
|
|
||||||
$enc_key = CreateKey::generateRandomKey();
|
$enc_key = CreateKey::generateRandomKey();
|
||||||
$encrypted = SymmetricEncryption::encrypt('test', $enc_key);
|
|
||||||
|
// class
|
||||||
|
$crypt = new SymmetricEncryption($key);
|
||||||
$this->expectExceptionMessage($exception_message);
|
$this->expectExceptionMessage($exception_message);
|
||||||
SymmetricEncryption::decrypt($encrypted, $key);
|
$crypt->encrypt('test');
|
||||||
|
$crypt->setKey($enc_key);
|
||||||
|
$encrypted = $crypt->encrypt('test');
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
$crypt->setKey($key);
|
||||||
|
$crypt->decrypt($encrypted);
|
||||||
|
|
||||||
|
// class instance
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::getInstance($key)->encrypt('test');
|
||||||
|
// we must encrypt valid thing first so we can fail with the wrong key
|
||||||
|
$encrypted = SymmetricEncryption::getInstance($enc_key)->encrypt('test');
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::getInstance($key)->decrypt($encrypted);
|
||||||
|
|
||||||
|
// class static
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::encryptKey('test', $key);
|
||||||
|
// we must encrypt valid thing first so we can fail with the wrong key
|
||||||
|
$encrypted = SymmetricEncryption::encryptKey('test', $enc_key);
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::decryptKey($encrypted, $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,7 +200,7 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
|
|||||||
return [
|
return [
|
||||||
'too short ciphertext' => [
|
'too short ciphertext' => [
|
||||||
'input' => 'short',
|
'input' => 'short',
|
||||||
'exception_message' => 'Invalid ciphertext (too short)'
|
'exception_message' => 'Decipher message failed: '
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -164,8 +219,18 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
|
|||||||
public function testWrongCiphertext(string $input, string $exception_message): void
|
public function testWrongCiphertext(string $input, string $exception_message): void
|
||||||
{
|
{
|
||||||
$key = CreateKey::generateRandomKey();
|
$key = CreateKey::generateRandomKey();
|
||||||
|
// class
|
||||||
|
$crypt = new SymmetricEncryption($key);
|
||||||
$this->expectExceptionMessage($exception_message);
|
$this->expectExceptionMessage($exception_message);
|
||||||
SymmetricEncryption::decrypt($input, $key);
|
$crypt->decrypt($input);
|
||||||
|
|
||||||
|
// class instance
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::getInstance($key)->decrypt($input);
|
||||||
|
|
||||||
|
// class static
|
||||||
|
$this->expectExceptionMessage($exception_message);
|
||||||
|
SymmetricEncryption::decryptKey($input, $key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# Exception rules
|
||||||
|
|
||||||
|
What exceptions to use for what
|
||||||
|
|
||||||
|
NOTE: There will be custom Excpetions creaed and so some rules will change
|
||||||
|
|
||||||
|
NOTE: For catching: always catch \Exception at the end to avoid missing some changed exceptions
|
||||||
|
|
||||||
|
NOTE: Changed exceptions will have marked as critical API change
|
||||||
|
|
||||||
|
## \Exception
|
||||||
|
|
||||||
|
if there is nothing else matching, use this one
|
||||||
|
|
||||||
|
## \InvalidArgumentException
|
||||||
|
|
||||||
|
if argument to a function is not expected type
|
||||||
|
|
||||||
|
## \UnexpectedValueException
|
||||||
|
|
||||||
|
If the value is not matching to what we expect
|
||||||
|
|
||||||
|
## \LengthException
|
||||||
|
|
||||||
|
Given value is out of range
|
||||||
|
|
||||||
|
## \RuntimeException
|
||||||
|
|
||||||
|
Missing php modules or external programs
|
||||||
|
|
||||||
|
## \OutOfRangeException
|
||||||
|
|
||||||
|
Not in range of given expression (array or other)
|
||||||
|
|
||||||
|
## Below are ERRORs
|
||||||
|
|
||||||
|
### \ArgumentCountError [ERROR]
|
||||||
|
|
||||||
|
If we have dynamic argument methods and we are missing a certain arguemnt count
|
||||||
|
|
||||||
|
### \TypeError
|
||||||
|
|
||||||
|
Invalid type
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
// // import globals from "globals";
|
||||||
|
// import js from '@eslint/js';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
// 'env': {
|
||||||
|
// 'browser': true,
|
||||||
|
// 'es6': true,
|
||||||
|
// 'commonjs': true,
|
||||||
|
// 'jquery': true
|
||||||
|
// },
|
||||||
|
// 'extends': 'eslint:recommended',
|
||||||
|
// 'parserOptions': {
|
||||||
|
// 'ecmaVersion': 11
|
||||||
|
// },
|
||||||
|
// ...eslint.configs.recommended,
|
||||||
|
'rules': {
|
||||||
|
'indent': [
|
||||||
|
'error',
|
||||||
|
'tab', {
|
||||||
|
'SwitchCase': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'linebreak-style': [
|
||||||
|
'error',
|
||||||
|
'unix'
|
||||||
|
],
|
||||||
|
'quotes': [
|
||||||
|
'error',
|
||||||
|
'single',
|
||||||
|
{ 'avoidEscape': true, 'allowTemplateLiterals': true }
|
||||||
|
],
|
||||||
|
'semi': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'no-console': 'off',
|
||||||
|
'no-unused-vars': [
|
||||||
|
'error', {
|
||||||
|
'vars': 'all',
|
||||||
|
'args': 'after-used',
|
||||||
|
'ignoreRestSiblings': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// Requires eslint >= v8.14.0
|
||||||
|
'no-constant-binary-expression': 'error'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// export default [
|
||||||
|
// ...js.configs.recommended,
|
||||||
|
// {
|
||||||
|
// files: ['**/*.js'],
|
||||||
|
// 'rules': {
|
||||||
|
// 'indent': [
|
||||||
|
// 'error',
|
||||||
|
// 'tab', {
|
||||||
|
// 'SwitchCase': 1
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// 'linebreak-style': [
|
||||||
|
// 'error',
|
||||||
|
// 'unix'
|
||||||
|
// ],
|
||||||
|
// 'quotes': [
|
||||||
|
// 'error',
|
||||||
|
// 'single',
|
||||||
|
// { 'avoidEscape': true, 'allowTemplateLiterals': true }
|
||||||
|
// ],
|
||||||
|
// 'semi': [
|
||||||
|
// 'error',
|
||||||
|
// 'always'
|
||||||
|
// ],
|
||||||
|
// 'no-console': 'off',
|
||||||
|
// 'no-unused-vars': [
|
||||||
|
// 'error', {
|
||||||
|
// 'vars': 'all',
|
||||||
|
// 'args': 'after-used',
|
||||||
|
// 'ignoreRestSiblings': false
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// // Requires eslint >= v8.14.0
|
||||||
|
// 'no-constant-binary-expression': 'error'
|
||||||
|
// },
|
||||||
|
// languageOptions: {
|
||||||
|
// globals: {
|
||||||
|
// ...globals.browser,
|
||||||
|
// ...globals.commonjs,
|
||||||
|
// ...globals.jquery,
|
||||||
|
// // myCustomGlobal: "readonly"
|
||||||
|
// 'ecmaVersion': 11
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// import globals from "globals";
|
||||||
|
// import js from '@eslint/js';
|
||||||
|
|
||||||
|
// export default [
|
||||||
|
// js.configs.recommended,
|
||||||
|
// {
|
||||||
|
// files: ['**/*.js'],
|
||||||
|
// rules: {
|
||||||
|
// 'indent': [
|
||||||
|
// 'error',
|
||||||
|
// 'tab', {
|
||||||
|
// 'SwitchCase': 1
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// 'linebreak-style': [
|
||||||
|
// 'error',
|
||||||
|
// 'unix'
|
||||||
|
// ],
|
||||||
|
// 'quotes': [
|
||||||
|
// 'error',
|
||||||
|
// 'single',
|
||||||
|
// { 'avoidEscape': true, 'allowTemplateLiterals': true }
|
||||||
|
// ],
|
||||||
|
// 'semi': [
|
||||||
|
// 'error',
|
||||||
|
// 'always'
|
||||||
|
// ],
|
||||||
|
// 'no-console': 'off',
|
||||||
|
// 'no-unused-vars': [
|
||||||
|
// 'error', {
|
||||||
|
// 'vars': 'all',
|
||||||
|
// 'args': 'after-used',
|
||||||
|
// 'ignoreRestSiblings': false
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// // Requires eslint >= v8.14.0
|
||||||
|
// 'no-constant-binary-expression': 'error'
|
||||||
|
// }/* ,
|
||||||
|
// languageOptions: {
|
||||||
|
// ecmaVersion: 11,
|
||||||
|
// // globals: {
|
||||||
|
// // ...globals.browser,
|
||||||
|
// // },
|
||||||
|
// } */
|
||||||
|
// }
|
||||||
|
// ];
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"target": "ES2020",
|
||||||
|
"jsx": "react",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"strictFunctionTypes": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/node_modules/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
Generated
+972
@@ -0,0 +1,972 @@
|
|||||||
|
{
|
||||||
|
"name": "trunk",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.12.0",
|
||||||
|
"eslint": "^9.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint-community/eslint-utils": {
|
||||||
|
"version": "4.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
||||||
|
"integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"eslint-visitor-keys": "^3.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {
|
||||||
|
"version": "3.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
|
||||||
|
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint-community/regexpp": {
|
||||||
|
"version": "4.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz",
|
||||||
|
"integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint/config-array": {
|
||||||
|
"version": "0.18.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz",
|
||||||
|
"integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@eslint/object-schema": "^2.1.4",
|
||||||
|
"debug": "^4.3.1",
|
||||||
|
"minimatch": "^3.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint/core": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint/eslintrc": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ajv": "^6.12.4",
|
||||||
|
"debug": "^4.3.2",
|
||||||
|
"espree": "^10.0.1",
|
||||||
|
"globals": "^14.0.0",
|
||||||
|
"ignore": "^5.2.0",
|
||||||
|
"import-fresh": "^3.2.1",
|
||||||
|
"js-yaml": "^4.1.0",
|
||||||
|
"minimatch": "^3.1.2",
|
||||||
|
"strip-json-comments": "^3.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint/js": {
|
||||||
|
"version": "9.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.12.0.tgz",
|
||||||
|
"integrity": "sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint/object-schema": {
|
||||||
|
"version": "2.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz",
|
||||||
|
"integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@eslint/plugin-kit": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"levn": "^0.4.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@humanfs/core": {
|
||||||
|
"version": "0.19.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.0.tgz",
|
||||||
|
"integrity": "sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.18.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@humanfs/node": {
|
||||||
|
"version": "0.16.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.5.tgz",
|
||||||
|
"integrity": "sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@humanfs/core": "^0.19.0",
|
||||||
|
"@humanwhocodes/retry": "^0.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.18.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@humanwhocodes/module-importer": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.22"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nzakas"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@humanwhocodes/retry": {
|
||||||
|
"version": "0.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz",
|
||||||
|
"integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nzakas"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/estree": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/@types/json-schema": {
|
||||||
|
"version": "7.0.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||||
|
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/acorn": {
|
||||||
|
"version": "8.12.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
|
||||||
|
"integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"acorn": "bin/acorn"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/acorn-jsx": {
|
||||||
|
"version": "5.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
|
||||||
|
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
|
||||||
|
"dev": true,
|
||||||
|
"peerDependencies": {
|
||||||
|
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ajv": {
|
||||||
|
"version": "6.12.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||||
|
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"fast-deep-equal": "^3.1.1",
|
||||||
|
"fast-json-stable-stringify": "^2.0.0",
|
||||||
|
"json-schema-traverse": "^0.4.1",
|
||||||
|
"uri-js": "^4.2.2"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/epoberezkin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/argparse": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/balanced-match": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/brace-expansion": {
|
||||||
|
"version": "1.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/callsites": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/chalk": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-convert": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/cross-spawn": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"path-key": "^3.1.0",
|
||||||
|
"shebang-command": "^2.0.0",
|
||||||
|
"which": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/debug": {
|
||||||
|
"version": "4.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
||||||
|
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/deep-is": {
|
||||||
|
"version": "0.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||||
|
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/escape-string-regexp": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/eslint": {
|
||||||
|
"version": "9.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.12.0.tgz",
|
||||||
|
"integrity": "sha512-UVIOlTEWxwIopRL1wgSQYdnVDcEvs2wyaO6DGo5mXqe3r16IoCNWkR29iHhyaP4cICWjbgbmFUGAhh0GJRuGZw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
|
"@eslint-community/regexpp": "^4.11.0",
|
||||||
|
"@eslint/config-array": "^0.18.0",
|
||||||
|
"@eslint/core": "^0.6.0",
|
||||||
|
"@eslint/eslintrc": "^3.1.0",
|
||||||
|
"@eslint/js": "9.12.0",
|
||||||
|
"@eslint/plugin-kit": "^0.2.0",
|
||||||
|
"@humanfs/node": "^0.16.5",
|
||||||
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
|
"@humanwhocodes/retry": "^0.3.1",
|
||||||
|
"@types/estree": "^1.0.6",
|
||||||
|
"@types/json-schema": "^7.0.15",
|
||||||
|
"ajv": "^6.12.4",
|
||||||
|
"chalk": "^4.0.0",
|
||||||
|
"cross-spawn": "^7.0.2",
|
||||||
|
"debug": "^4.3.2",
|
||||||
|
"escape-string-regexp": "^4.0.0",
|
||||||
|
"eslint-scope": "^8.1.0",
|
||||||
|
"eslint-visitor-keys": "^4.1.0",
|
||||||
|
"espree": "^10.2.0",
|
||||||
|
"esquery": "^1.5.0",
|
||||||
|
"esutils": "^2.0.2",
|
||||||
|
"fast-deep-equal": "^3.1.3",
|
||||||
|
"file-entry-cache": "^8.0.0",
|
||||||
|
"find-up": "^5.0.0",
|
||||||
|
"glob-parent": "^6.0.2",
|
||||||
|
"ignore": "^5.2.0",
|
||||||
|
"imurmurhash": "^0.1.4",
|
||||||
|
"is-glob": "^4.0.0",
|
||||||
|
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||||
|
"lodash.merge": "^4.6.2",
|
||||||
|
"minimatch": "^3.1.2",
|
||||||
|
"natural-compare": "^1.4.0",
|
||||||
|
"optionator": "^0.9.3",
|
||||||
|
"text-table": "^0.2.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"eslint": "bin/eslint.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://eslint.org/donate"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"jiti": "*"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"jiti": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/eslint-scope": {
|
||||||
|
"version": "8.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.1.0.tgz",
|
||||||
|
"integrity": "sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"esrecurse": "^4.3.0",
|
||||||
|
"estraverse": "^5.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/eslint-visitor-keys": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/espree": {
|
||||||
|
"version": "10.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/espree/-/espree-10.2.0.tgz",
|
||||||
|
"integrity": "sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"acorn": "^8.12.0",
|
||||||
|
"acorn-jsx": "^5.3.2",
|
||||||
|
"eslint-visitor-keys": "^4.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esquery": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
|
||||||
|
"integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"estraverse": "^5.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esrecurse": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"estraverse": "^5.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/estraverse": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esutils": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fast-deep-equal": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/fast-json-stable-stringify": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/fast-levenshtein": {
|
||||||
|
"version": "2.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||||
|
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/file-entry-cache": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"flat-cache": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/find-up": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"locate-path": "^6.0.0",
|
||||||
|
"path-exists": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/flat-cache": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"flatted": "^3.2.9",
|
||||||
|
"keyv": "^4.5.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/flatted": {
|
||||||
|
"version": "3.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
|
||||||
|
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/glob-parent": {
|
||||||
|
"version": "6.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
|
||||||
|
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-glob": "^4.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/globals": {
|
||||||
|
"version": "14.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
|
||||||
|
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/has-flag": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ignore": {
|
||||||
|
"version": "5.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
|
||||||
|
"integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/import-fresh": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"parent-module": "^1.0.0",
|
||||||
|
"resolve-from": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/imurmurhash": {
|
||||||
|
"version": "0.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||||
|
"integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8.19"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-extglob": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-glob": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-extglob": "^2.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/isexe": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/js-yaml": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"argparse": "^2.0.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"js-yaml": "bin/js-yaml.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/json-buffer": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/json-schema-traverse": {
|
||||||
|
"version": "0.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||||
|
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/json-stable-stringify-without-jsonify": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/keyv": {
|
||||||
|
"version": "4.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
|
||||||
|
"integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"json-buffer": "3.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/levn": {
|
||||||
|
"version": "0.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
|
||||||
|
"integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"prelude-ls": "^1.2.1",
|
||||||
|
"type-check": "~0.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/locate-path": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"p-locate": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lodash.merge": {
|
||||||
|
"version": "4.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||||
|
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/minimatch": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/natural-compare": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/optionator": {
|
||||||
|
"version": "0.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
|
||||||
|
"integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"deep-is": "^0.1.3",
|
||||||
|
"fast-levenshtein": "^2.0.6",
|
||||||
|
"levn": "^0.4.1",
|
||||||
|
"prelude-ls": "^1.2.1",
|
||||||
|
"type-check": "^0.4.0",
|
||||||
|
"word-wrap": "^1.2.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/p-limit": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"yocto-queue": "^0.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/p-locate": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"p-limit": "^3.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/parent-module": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"callsites": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-exists": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-key": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/prelude-ls": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/punycode": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/resolve-from": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/shebang-command": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"shebang-regex": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/shebang-regex": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/strip-json-comments": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/supports-color": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"has-flag": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/text-table": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/type-check": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"prelude-ls": "^1.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/uri-js": {
|
||||||
|
"version": "4.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
|
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"punycode": "^2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"node-which": "bin/node-which"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/word-wrap": {
|
||||||
|
"version": "1.2.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||||
|
"integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/yocto-queue": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.12.0",
|
||||||
|
"eslint": "^9.12.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="MyStandard">
|
||||||
|
<description>PSR12 override rules (strict, standard). Switch spaces indent to tab.</description>
|
||||||
|
<arg name="tab-width" value="4"/>
|
||||||
|
<rule ref="PSR1"/>
|
||||||
|
<rule ref="PSR12">
|
||||||
|
<!-- turn off white space check for tab -->
|
||||||
|
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||||
|
</rule>
|
||||||
|
<!-- no space indent, must be tab, 4 is tab iwdth -->
|
||||||
|
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
|
||||||
|
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||||
|
<properties>
|
||||||
|
<property name="indent" value="4"/>
|
||||||
|
<property name="tabIndent" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
includes:
|
includes:
|
||||||
- phpstan-conditional.php
|
- phpstan-conditional.php
|
||||||
parameters:
|
parameters:
|
||||||
tmpDir: /tmp/phpstan-corelibs
|
tmpDir: %currentWorkingDirectory%/tmp/phpstan-corelibs
|
||||||
level: 8 # max is now 9
|
level: 8 # max is now 9
|
||||||
checkMissingCallableSignature: true
|
checkMissingCallableSignature: true
|
||||||
treatPhpDocTypesAsCertain: false
|
treatPhpDocTypesAsCertain: false
|
||||||
|
|||||||
File renamed without changes.
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/phan-5.4.2.phar
|
/home/clemens/.phive/phars/phan-5.4.3.phar
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/php-cs-fixer-3.34.1.phar
|
/home/clemens/.phive/phars/php-cs-fixer-3.57.2.phar
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/phpdocumentor-3.4.2.phar
|
/home/clemens/.phive/phars/phpdocumentor-3.4.3.phar
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/phpcbf-3.7.2.phar
|
/home/clemens/.phive/phars/phpcbf-3.10.3.phar
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/phpcs-3.7.2.phar
|
/home/clemens/.phive/phars/phpcs-3.10.3.phar
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/phpstan-1.10.37.phar
|
/home/clemens/.phive/phars/phpstan-1.12.4.phar
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/phpunit-9.6.13.phar
|
/home/clemens/.phive/phars/phpunit-9.6.21.phar
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
/home/clemens/.phive/phars/psalm-5.15.0.phar
|
/home/clemens/.phive/phars/psalm-5.24.0.phar
|
||||||
@@ -46,7 +46,7 @@ use CoreLibs\Debug\Support;
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: ADMIN BACKEND';
|
$PAGE_NAME = 'TEST CLASS: ADMIN BACKEND';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ ob_end_flush();
|
|||||||
use CoreLibs\Combined\ArrayHandler;
|
use CoreLibs\Combined\ArrayHandler;
|
||||||
use CoreLibs\Debug\Support as DgS;
|
use CoreLibs\Debug\Support as DgS;
|
||||||
use CoreLibs\Convert\SetVarType;
|
use CoreLibs\Convert\SetVarType;
|
||||||
|
// use PHPUnit\Framework\Constraint\ArrayHasKey;
|
||||||
|
|
||||||
$log = new CoreLibs\Logging\Logging([
|
$log = new CoreLibs\Logging\Logging([
|
||||||
'log_folder' => BASE . LOG,
|
'log_folder' => BASE . LOG,
|
||||||
@@ -32,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: ARRAY HANDLER';
|
$PAGE_NAME = 'TEST CLASS: ARRAY HANDLER';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -236,6 +237,22 @@ $flag = false;
|
|||||||
$output = \CoreLibs\Combined\ArrayHandler::genAssocArray($db_array, $key, $value, $flag);
|
$output = \CoreLibs\Combined\ArrayHandler::genAssocArray($db_array, $key, $value, $flag);
|
||||||
print "OUTPUT: " . \CoreLibs\Debug\Support::printAr($output) . "<br>";
|
print "OUTPUT: " . \CoreLibs\Debug\Support::printAr($output) . "<br>";
|
||||||
|
|
||||||
|
|
||||||
|
print "<hr>";
|
||||||
|
$array = [
|
||||||
|
'a' => 'First',
|
||||||
|
'b' => 'Second',
|
||||||
|
'c' => 'Third',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach (array_keys($array) as $search) {
|
||||||
|
print "Result[" . $search . "]: "
|
||||||
|
. "next: " . DgS::printAr(ArrayHandler::arrayGetNextKey($array, $search)) . ", "
|
||||||
|
. "prev: " . DgS::printAr(ArrayHandler::arrayGetPrevKey($array, $search))
|
||||||
|
. "<br>";
|
||||||
|
}
|
||||||
|
print "Key not exists: " . DgS::printAr(ArrayHandler::arrayGetNextKey($array, 'z')) . "<br>";
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -23,7 +23,7 @@ use CoreLibs\Convert\Byte;
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: AUTOLOADER';
|
$PAGE_NAME = 'TEST CLASS: AUTOLOADER';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $byte_class = 'CoreLibs\Convert\Byte';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: BYTE CONVERT';
|
$PAGE_NAME = 'TEST CLASS: BYTE CONVERT';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: CHECK COLORS';
|
$PAGE_NAME = 'TEST CLASS: CHECK COLORS';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ $db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: CLASS CALLS';
|
$PAGE_NAME = 'TEST CLASS: CLASS CALLS';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: CONFIG DIRECT';
|
$PAGE_NAME = 'TEST CLASS: CONFIG DIRECT';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: CONFIG LINK';
|
$PAGE_NAME = 'TEST CLASS: CONFIG LINK';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ $color_class = 'CoreLibs\Convert\Colors';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: CONVERT COLORS';
|
$PAGE_NAME = 'TEST CLASS: CONVERT COLORS';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: CREATE EMAIL';
|
$PAGE_NAME = 'TEST CLASS: CREATE EMAIL';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ $datetime_class = 'CoreLibs\Combined\DateTime';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: DATE/TIME';
|
$PAGE_NAME = 'TEST CLASS: DATE/TIME';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -51,10 +51,7 @@ if (round($timestamp, 4) == DateTime::stringToTime($time_string)) {
|
|||||||
} else {
|
} else {
|
||||||
print "REVERSE TRIME STRING DO NOT MATCH<br>";
|
print "REVERSE TRIME STRING DO NOT MATCH<br>";
|
||||||
}
|
}
|
||||||
print "ZERO TIME STRING: " . DateTime::timeStringFormat(0, true) . "<br>";
|
print "<hr>";
|
||||||
print "ZERO TIME STRING: " . DateTime::timeStringFormat(0.0, true) . "<br>";
|
|
||||||
print "ZERO TIME STRING: " . DateTime::timeStringFormat(1.005, true) . "<br>";
|
|
||||||
|
|
||||||
$timestamps = [
|
$timestamps = [
|
||||||
1622788315.123456,
|
1622788315.123456,
|
||||||
-1622788315.456789
|
-1622788315.456789
|
||||||
@@ -64,6 +61,159 @@ foreach ($timestamps as $timestamp) {
|
|||||||
print "DATESTRINGFORMAT(sm:1:0): $timestamp: " . DateTime::dateStringFormat($timestamp, true) . "<br>";
|
print "DATESTRINGFORMAT(sm:1:0): $timestamp: " . DateTime::dateStringFormat($timestamp, true) . "<br>";
|
||||||
print "DATESTRINGFORMAT(sm:1:1): $timestamp: " . DateTime::dateStringFormat($timestamp, true, true) . "<br>";
|
print "DATESTRINGFORMAT(sm:1:1): $timestamp: " . DateTime::dateStringFormat($timestamp, true, true) . "<br>";
|
||||||
}
|
}
|
||||||
|
print "<hr>";
|
||||||
|
// $interval = 0;
|
||||||
|
// $interval = 1000000;
|
||||||
|
// $interval = 123456;
|
||||||
|
// $interval = 3600;
|
||||||
|
$interval = 3601;
|
||||||
|
// $interval = 86400;
|
||||||
|
// $interval = 86401;
|
||||||
|
// $interval = (86400 * 606) + 16434.5;
|
||||||
|
// $interval = 1.5;
|
||||||
|
// $interval = 123456;
|
||||||
|
// $interval = 120.1;
|
||||||
|
// $interval = 1641515890;
|
||||||
|
// $interval = 0.123456;
|
||||||
|
// $interval = 1641515890;
|
||||||
|
// $interval = 999999999999999999;
|
||||||
|
// $interval = 60;
|
||||||
|
try {
|
||||||
|
// print "Test-DEP: [$interval] "
|
||||||
|
// . intervalStringFormatDeprecated(
|
||||||
|
// $interval,
|
||||||
|
// truncate_after: '',
|
||||||
|
// natural_seperator: false,
|
||||||
|
// name_space_seperator: false,
|
||||||
|
// show_microseconds: true,
|
||||||
|
// short_time_name: true,
|
||||||
|
// skip_last_zero: true,
|
||||||
|
// skip_zero: false,
|
||||||
|
// show_only_days: false,
|
||||||
|
// auto_fix_microseconds: false,
|
||||||
|
// truncate_nanoseconds: false,
|
||||||
|
// truncate_zero_seconds_if_microseconds: true,
|
||||||
|
// )
|
||||||
|
// // . " => "
|
||||||
|
// // . DateTime::intervalStringFormat($interval)
|
||||||
|
// . "<br>";
|
||||||
|
print "Test-ACT: [$interval] "
|
||||||
|
. DateTime::intervalStringFormat(
|
||||||
|
$interval,
|
||||||
|
truncate_after: '',
|
||||||
|
natural_seperator: false,
|
||||||
|
name_space_seperator: false,
|
||||||
|
show_microseconds: true,
|
||||||
|
short_time_name: true,
|
||||||
|
skip_last_zero: true,
|
||||||
|
skip_zero: false,
|
||||||
|
show_only_days: false,
|
||||||
|
auto_fix_microseconds: false,
|
||||||
|
truncate_nanoseconds: false,
|
||||||
|
truncate_zero_seconds_if_microseconds: true,
|
||||||
|
)
|
||||||
|
. " => "
|
||||||
|
. DateTime::intervalStringFormat($interval)
|
||||||
|
. "<br>";
|
||||||
|
print "DEFAULT-DEP: " . intervalStringFormatDeprecated($interval) . "<br>";
|
||||||
|
print "DEFAULT-ACT: " . DateTime::intervalStringFormat($interval) . "<br>";
|
||||||
|
$show_micro = true;
|
||||||
|
// print "COMPATIBLE Test-DEP: " .
|
||||||
|
// intervalStringFormatDeprecated(
|
||||||
|
// $interval,
|
||||||
|
// show_microseconds: $show_micro,
|
||||||
|
// show_only_days: true,
|
||||||
|
// skip_zero: false,
|
||||||
|
// skip_last_zero: false,
|
||||||
|
// truncate_nanoseconds: true,
|
||||||
|
// truncate_zero_seconds_if_microseconds: false
|
||||||
|
// ) . "<br>";
|
||||||
|
print "COMPATIBLE Test-ACT: " .
|
||||||
|
DateTime::intervalStringFormat(
|
||||||
|
$interval,
|
||||||
|
show_microseconds: $show_micro,
|
||||||
|
show_only_days: true,
|
||||||
|
skip_zero: false,
|
||||||
|
skip_last_zero: false,
|
||||||
|
truncate_nanoseconds: true,
|
||||||
|
truncate_zero_seconds_if_microseconds: false
|
||||||
|
) . "<br>";
|
||||||
|
print "ORIGINAL: " . DateTime::timeStringFormat($interval, $show_micro) . "<br>";
|
||||||
|
} catch (\UnexpectedValueException $e) {
|
||||||
|
print "ERROR: " . $e->getMessage() . "<br><pre>" . $e . "</pre><br>";
|
||||||
|
} catch (\LengthException $e) {
|
||||||
|
print "ERROR interval: " . $e->getMessage() . "<br><pre>" . $e . "</pre><br>";
|
||||||
|
}
|
||||||
|
print "<hr>";
|
||||||
|
$intervals = [
|
||||||
|
['i' => 0, 'sm' => true],
|
||||||
|
['i' => 0.0, 'sm' => true],
|
||||||
|
['i' => 1.5, 'sm' => true],
|
||||||
|
['i' => 1.05, 'sm' => true],
|
||||||
|
['i' => 1.005, 'sm' => true],
|
||||||
|
['i' => 1.0005, 'sm' => true],
|
||||||
|
];
|
||||||
|
foreach ($intervals as $int) {
|
||||||
|
$info = 'ts:' . $int['i'] . '|' . 'sm:' . $int['sm'];
|
||||||
|
print "[tsf] ZERO TIME STRING [$info]: "
|
||||||
|
. DateTime::timeStringFormat($int['i'], $int['sm']) . "<br>";
|
||||||
|
print "[isf] ZERO TIME STRING [$info]: "
|
||||||
|
. DateTime::intervalStringFormat($int['i'], show_microseconds:$int['sm']) . "<br>";
|
||||||
|
}
|
||||||
|
print "<hr>";
|
||||||
|
$intervals = [
|
||||||
|
[
|
||||||
|
'i' => 788315.123456,
|
||||||
|
'truncate_after' => '',
|
||||||
|
'natural_seperator' => false,
|
||||||
|
'name_space_seperator' => false,
|
||||||
|
'show_microseconds' => true,
|
||||||
|
'short_time_name' => true,
|
||||||
|
'skip_last_zero' => false,
|
||||||
|
'skip_zero' => true,
|
||||||
|
'show_only_days' => false,
|
||||||
|
'auto_fix_microseconds' => false,
|
||||||
|
'truncate_nanoseconds' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'i' => 788315.123456,
|
||||||
|
'truncate_after' => '',
|
||||||
|
'natural_seperator' => true,
|
||||||
|
'name_space_seperator' => true,
|
||||||
|
'show_microseconds' => true,
|
||||||
|
'short_time_name' => true,
|
||||||
|
'skip_last_zero' => false,
|
||||||
|
'skip_zero' => true,
|
||||||
|
'show_only_days' => false,
|
||||||
|
'auto_fix_microseconds' => false,
|
||||||
|
'truncate_nanoseconds' => false
|
||||||
|
],
|
||||||
|
];
|
||||||
|
foreach ($intervals as $int) {
|
||||||
|
$info = $int['i'];
|
||||||
|
try {
|
||||||
|
print "INTRVALSTRINGFORMAT(sm:0): $info: "
|
||||||
|
. DateTime::intervalStringFormat(
|
||||||
|
$int['i'],
|
||||||
|
truncate_after: (string)$int['truncate_after'],
|
||||||
|
natural_seperator: $int['natural_seperator'],
|
||||||
|
name_space_seperator: $int['name_space_seperator'],
|
||||||
|
show_microseconds: $int['show_microseconds'],
|
||||||
|
short_time_name: $int['short_time_name'],
|
||||||
|
skip_last_zero: $int['skip_last_zero'],
|
||||||
|
skip_zero: $int['skip_zero'],
|
||||||
|
show_only_days: $int['show_only_days'],
|
||||||
|
auto_fix_microseconds: $int['auto_fix_microseconds'],
|
||||||
|
truncate_nanoseconds: $int['truncate_nanoseconds'],
|
||||||
|
) . "<br>";
|
||||||
|
} catch (\UnexpectedValueException $e) {
|
||||||
|
print "ERROR: " . $e->getMessage() . "<br><pre>" . $e . "</pre><br>";
|
||||||
|
} catch (\LengthException $e) {
|
||||||
|
print "ERROR interval: " . $e->getMessage() . "<br><pre>" . $e . "</pre><br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "<hr>";
|
||||||
|
// convert and reverste tests
|
||||||
$intervals = [
|
$intervals = [
|
||||||
788315.123456,
|
788315.123456,
|
||||||
-123.456
|
-123.456
|
||||||
@@ -74,6 +224,7 @@ foreach ($intervals as $interval) {
|
|||||||
print "TIMESTRINGFORMAT(sm:1): $interval: " . $reverse_interval . "<br>";
|
print "TIMESTRINGFORMAT(sm:1): $interval: " . $reverse_interval . "<br>";
|
||||||
print "STRINGTOTIME: $reverse_interval: " . DateTime::stringToTime($reverse_interval) . "<br>";
|
print "STRINGTOTIME: $reverse_interval: " . DateTime::stringToTime($reverse_interval) . "<br>";
|
||||||
}
|
}
|
||||||
|
print "<hr>";
|
||||||
$check_dates = [
|
$check_dates = [
|
||||||
'2021-05-01',
|
'2021-05-01',
|
||||||
'2021-05-40'
|
'2021-05-40'
|
||||||
@@ -81,6 +232,7 @@ $check_dates = [
|
|||||||
foreach ($check_dates as $check_date) {
|
foreach ($check_dates as $check_date) {
|
||||||
print "CHECKDATE: $check_date: " . (string)DateTime::checkDate($check_date) . "<br>";
|
print "CHECKDATE: $check_date: " . (string)DateTime::checkDate($check_date) . "<br>";
|
||||||
}
|
}
|
||||||
|
print "<hr>";
|
||||||
$check_datetimes = [
|
$check_datetimes = [
|
||||||
'2021-05-01',
|
'2021-05-01',
|
||||||
'2021-05-40',
|
'2021-05-40',
|
||||||
@@ -91,6 +243,7 @@ $check_datetimes = [
|
|||||||
foreach ($check_datetimes as $check_datetime) {
|
foreach ($check_datetimes as $check_datetime) {
|
||||||
print "CHECKDATETIME: $check_datetime: " . (string)DateTime::checkDateTime($check_datetime) . "<br>";
|
print "CHECKDATETIME: $check_datetime: " . (string)DateTime::checkDateTime($check_datetime) . "<br>";
|
||||||
}
|
}
|
||||||
|
print "<hr>";
|
||||||
$compare_dates = [
|
$compare_dates = [
|
||||||
[ '2021-05-01', '2021-05-02', ],
|
[ '2021-05-01', '2021-05-02', ],
|
||||||
[ '2021-05-02', '2021-05-01', ],
|
[ '2021-05-02', '2021-05-01', ],
|
||||||
@@ -102,6 +255,7 @@ foreach ($compare_dates as $compare_date) {
|
|||||||
print "COMPAREDATE: $compare_date[0] = $compare_date[1]: "
|
print "COMPAREDATE: $compare_date[0] = $compare_date[1]: "
|
||||||
. (string)DateTime::compareDate($compare_date[0], $compare_date[1]) . "<br>";
|
. (string)DateTime::compareDate($compare_date[0], $compare_date[1]) . "<br>";
|
||||||
}
|
}
|
||||||
|
print "<hr>";
|
||||||
$compare_datetimes = [
|
$compare_datetimes = [
|
||||||
[ '2021-05-01', '2021-05-02', ],
|
[ '2021-05-01', '2021-05-02', ],
|
||||||
[ '2021-05-02', '2021-05-01', ],
|
[ '2021-05-02', '2021-05-01', ],
|
||||||
@@ -114,6 +268,7 @@ foreach ($compare_datetimes as $compare_datetime) {
|
|||||||
print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: "
|
print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: "
|
||||||
. (string)DateTime::compareDateTime($compare_datetime[0], $compare_datetime[1]) . "<br>";
|
. (string)DateTime::compareDateTime($compare_datetime[0], $compare_datetime[1]) . "<br>";
|
||||||
}
|
}
|
||||||
|
print "<hr>";
|
||||||
$compare_dates = [
|
$compare_dates = [
|
||||||
[ '2021-05-01', '2021-05-10', ],
|
[ '2021-05-01', '2021-05-10', ],
|
||||||
[ '2021-05-10', '2021-05-01', ],
|
[ '2021-05-10', '2021-05-01', ],
|
||||||
@@ -126,7 +281,7 @@ foreach ($compare_dates as $compare_date) {
|
|||||||
print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: "
|
print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: "
|
||||||
. DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1], true)) . "<br>";
|
. DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1], true)) . "<br>";
|
||||||
}
|
}
|
||||||
|
print "<hr>";
|
||||||
// test date conversion
|
// test date conversion
|
||||||
$dow = 2;
|
$dow = 2;
|
||||||
print "DOW[$dow]: " . DateTime::setWeekdayNameFromIsoDow($dow) . "<br>";
|
print "DOW[$dow]: " . DateTime::setWeekdayNameFromIsoDow($dow) . "<br>";
|
||||||
@@ -142,7 +297,7 @@ $date = '2022-70-242';
|
|||||||
print "DATE-dow[$date];invalid: " . DateTime::setWeekdayNameFromDate($date) . "<br>";
|
print "DATE-dow[$date];invalid: " . DateTime::setWeekdayNameFromDate($date) . "<br>";
|
||||||
print "DATE-dow[$date],long;invalid: " . DateTime::setWeekdayNameFromDate($date, true) . "<br>";
|
print "DATE-dow[$date],long;invalid: " . DateTime::setWeekdayNameFromDate($date, true) . "<br>";
|
||||||
print "DOW-date[$date];invalid: " . DateTime::setWeekdayNumberFromDate($date) . "<br>";
|
print "DOW-date[$date];invalid: " . DateTime::setWeekdayNumberFromDate($date) . "<br>";
|
||||||
|
print "<hr>";
|
||||||
// check date range includes a weekend
|
// check date range includes a weekend
|
||||||
// does not:
|
// does not:
|
||||||
$start_date = '2023-07-03';
|
$start_date = '2023-07-03';
|
||||||
@@ -165,4 +320,238 @@ print "Has Weekend: " . $start_date . " ~ " . $end_date . ": "
|
|||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DEPREACTED, original rewrite, do not use
|
||||||
|
*
|
||||||
|
* update timeStringFormat with year and month support
|
||||||
|
*
|
||||||
|
* The following flags have to be set to be timeStringFormat compatible.
|
||||||
|
* Not that on seconds overflow this method will throw an exception, timeStringFormat returned -1s
|
||||||
|
* show_only_days: true,
|
||||||
|
* skip_zero: false,
|
||||||
|
* skip_last_zero: false,
|
||||||
|
* truncate_nanoseconds: true,
|
||||||
|
* truncate_zero_seconds_if_microseconds: false
|
||||||
|
*
|
||||||
|
* @param int|float $seconds Seconds to convert, maxium 6 decimals,
|
||||||
|
* else \UnexpectedValueException will be thrown
|
||||||
|
* if days too large or years too large \LengthException is thrown
|
||||||
|
* @param string $truncate_after [=''] Truncate after which time name, will not round, hard end
|
||||||
|
* values are parts names or interval short names (y, d, f, ...)
|
||||||
|
* if illegal value \UnexpectedValueException is thrown
|
||||||
|
* @param bool $natural_seperator [=false] use ',' and 'and', if off use space
|
||||||
|
* @param bool $name_space_seperator [=false] add a space between the number and the time name
|
||||||
|
* @param bool $show_microseconds [=true] show microseconds
|
||||||
|
* @param bool $short_time_name [=true] use the short time names (eg s instead of seconds)
|
||||||
|
* @param bool $skip_last_zero [=true] skip all trailing zero values, eg 5m 0s => 5m
|
||||||
|
* @param bool $skip_zero [=true] do not show zero values anywhere, eg 1h 0m 20s => 1h 20s
|
||||||
|
* @param bool $show_only_days [=false] do not show years or months, show only days
|
||||||
|
* if truncate after is set to year or month
|
||||||
|
* throws \UnexpectedValueException
|
||||||
|
* @param bool $auto_fix_microseconds [=false] if the micro seconds decimals are more than 6, round them
|
||||||
|
* on defaul throw \UnexpectedValueException
|
||||||
|
* @param bool $truncate_nanoseconds [=false] if microseconds decimals >3 then normal we show 123.4ms
|
||||||
|
* cut the .4 is set to true
|
||||||
|
* @param bool $truncate_zero_seconds_if_microseconds [=true] if we have 0.123 seconds then if true no seconds
|
||||||
|
* will be shown
|
||||||
|
* @return string
|
||||||
|
* @throws \UnexpectedValueException if seconds has more than 6 decimals
|
||||||
|
* if truncate has an illegal value
|
||||||
|
* if truncate is set to year or month and show_only_days is turned on
|
||||||
|
* @throws \LengthException if seconds is too large and show_days_only is selected and days is negetive
|
||||||
|
* or if years is negativ
|
||||||
|
*/
|
||||||
|
function intervalStringFormatDeprecated(
|
||||||
|
int|float $seconds,
|
||||||
|
string $truncate_after = '',
|
||||||
|
bool $natural_seperator = false,
|
||||||
|
bool $name_space_seperator = false,
|
||||||
|
bool $show_microseconds = true,
|
||||||
|
bool $short_time_name = true,
|
||||||
|
bool $skip_last_zero = true,
|
||||||
|
bool $skip_zero = true,
|
||||||
|
bool $show_only_days = false,
|
||||||
|
bool $auto_fix_microseconds = false,
|
||||||
|
bool $truncate_nanoseconds = false,
|
||||||
|
bool $truncate_zero_seconds_if_microseconds = true,
|
||||||
|
): string {
|
||||||
|
// auto fix long seconds, else \UnexpectedValueException will be thrown on error
|
||||||
|
// check if we have float and -> round to 6
|
||||||
|
if ($auto_fix_microseconds === true && is_float($seconds)) {
|
||||||
|
$seconds = round($seconds, 6);
|
||||||
|
}
|
||||||
|
// flag negative + set abs
|
||||||
|
$negative = $seconds < 0 ? '-' : '';
|
||||||
|
$seconds = abs($seconds);
|
||||||
|
// create base time
|
||||||
|
$date_now = new \DateTime("@0");
|
||||||
|
try {
|
||||||
|
$date_seconds = new \DateTime("@$seconds");
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new \UnexpectedValueException(
|
||||||
|
'Seconds value is invalid, too large or more than six decimals: ' . $seconds,
|
||||||
|
1,
|
||||||
|
$e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$interval = date_diff($date_now, $date_seconds);
|
||||||
|
// if show_only_days and negative but input postive alert that this has to be done in y/m/d ...
|
||||||
|
if ($interval->y < 0) {
|
||||||
|
throw new \LengthException('Input seconds value is too large for years output: ' . $seconds, 2);
|
||||||
|
} elseif ($interval->days < 0 && $show_only_days === true) {
|
||||||
|
throw new \LengthException('Input seconds value is too large for days output: ' . $seconds, 3);
|
||||||
|
}
|
||||||
|
// array order is important, small too large
|
||||||
|
$parts = [
|
||||||
|
'microseconds' => 'f',
|
||||||
|
'seconds' => 's', 'minutes' => 'i', 'hours' => 'h',
|
||||||
|
'days' => 'd', 'months' => 'm', 'years' => 'y',
|
||||||
|
];
|
||||||
|
$short_name = [
|
||||||
|
'years' => 'y', 'months' => 'm', 'days' => 'd',
|
||||||
|
'hours' => 'h', 'minutes' => 'm', 'seconds' => 's',
|
||||||
|
'microseconds' => 'ms'
|
||||||
|
];
|
||||||
|
$skip = false;
|
||||||
|
if (!empty($truncate_after)) {
|
||||||
|
// if truncate after not in key or value in parts
|
||||||
|
if (!in_array($truncate_after, array_keys($parts)) && !in_array($truncate_after, array_values($parts))) {
|
||||||
|
throw new \UnexpectedValueException(
|
||||||
|
'truncate_after has an invalid value: ' . $truncate_after,
|
||||||
|
4
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// if truncate after is y or m and we have show_only_days, throw exception
|
||||||
|
if ($show_only_days === true && in_array($truncate_after, ['y', 'years', 'm', 'months'])) {
|
||||||
|
throw new \UnexpectedValueException(
|
||||||
|
'If show_only_days is turned on, the truncate_after cannot be years or months: '
|
||||||
|
. $truncate_after,
|
||||||
|
5
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$skip = true;
|
||||||
|
}
|
||||||
|
$formatted = [];
|
||||||
|
$zero_list = [];
|
||||||
|
$zero_last_list = [];
|
||||||
|
$add_zero_seconds = false;
|
||||||
|
foreach ($parts as $time_name => $part) {
|
||||||
|
// end for micro seconds
|
||||||
|
if ($show_microseconds === false && $time_name == 'microseconds') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// skip at this time position
|
||||||
|
if ($part == $truncate_after || $truncate_after == $time_name) {
|
||||||
|
$skip = false;
|
||||||
|
}
|
||||||
|
if ($skip === true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($show_only_days === true && $part == 'd') {
|
||||||
|
$value = $interval->days;
|
||||||
|
$skip = true;
|
||||||
|
} else {
|
||||||
|
/** @phan-suppress-next-line PhanUndeclaredProperty */
|
||||||
|
$value = $interval->$part;
|
||||||
|
}
|
||||||
|
if ($value == 0 && $skip_last_zero === true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// print "-> V: $value | $part, $time_name | I: " . is_int($value) . " | F: " . is_float($value)
|
||||||
|
// . " | " . ($value != 0 ? 'Not zero' : 'ZERO') . "<br>";
|
||||||
|
// var_dump($skip_last_zero);
|
||||||
|
if ($value != 0 || $skip_zero === false || $skip_last_zero === false) {
|
||||||
|
if ($part == 'f') {
|
||||||
|
if ($truncate_nanoseconds === true) {
|
||||||
|
$value = round($value, 3);
|
||||||
|
}
|
||||||
|
$value *= 1000;
|
||||||
|
// anything above that is nano seconds?
|
||||||
|
}
|
||||||
|
// on first hit turn off (full off)
|
||||||
|
if ($value) {
|
||||||
|
$skip_last_zero = null;
|
||||||
|
} elseif ($skip_last_zero === false) {
|
||||||
|
$zero_last_list[] = $part;
|
||||||
|
}
|
||||||
|
// build format
|
||||||
|
$format = "$value";
|
||||||
|
if ($name_space_seperator) {
|
||||||
|
$format .= " ";
|
||||||
|
}
|
||||||
|
if ($short_time_name) {
|
||||||
|
$format .= $short_name[$time_name];
|
||||||
|
} elseif ($value == 1) {
|
||||||
|
$format .= substr($time_name, 0, -1);
|
||||||
|
} else {
|
||||||
|
$format .= $time_name;
|
||||||
|
}
|
||||||
|
$formatted[] = $format;
|
||||||
|
}
|
||||||
|
// if we have 0 value, but only for skip zero condition
|
||||||
|
if ($skip_zero === false) {
|
||||||
|
if ($value == 0) {
|
||||||
|
$zero_list[] = $part;
|
||||||
|
} else {
|
||||||
|
$zero_list = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
$part == 's' && $value == 0 &&
|
||||||
|
$show_microseconds === true &&
|
||||||
|
$truncate_zero_seconds_if_microseconds === false
|
||||||
|
) {
|
||||||
|
$add_zero_seconds = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if there is a zero list, strip that from the beginning, this is done always
|
||||||
|
if (count($zero_list)) {
|
||||||
|
// strip
|
||||||
|
$formatted = array_slice($formatted, 0, count($zero_list) * -1);
|
||||||
|
} elseif (count($zero_last_list) == count($formatted)) {
|
||||||
|
// if we have all skip empty last, then we do not have any value
|
||||||
|
$formatted = [];
|
||||||
|
}
|
||||||
|
$formatted = array_reverse($formatted);
|
||||||
|
// print "=> F: " . print_r($formatted, true)
|
||||||
|
// . " | Z: " . print_r($zero_list, true)
|
||||||
|
// . " | ZL: " . print_r($zero_last_list, true)
|
||||||
|
// . "<br>";
|
||||||
|
if (count($formatted) == 0) {
|
||||||
|
// if we have truncate on, then we assume nothing was found
|
||||||
|
$str = "0";
|
||||||
|
if ($name_space_seperator) {
|
||||||
|
$str .= " ";
|
||||||
|
}
|
||||||
|
// if truncate is on, we assume we found nothing
|
||||||
|
if (!empty($truncate_after)) {
|
||||||
|
if (in_array($truncate_after, array_values($parts))) {
|
||||||
|
$truncate_after = array_flip($parts)[$truncate_after];
|
||||||
|
}
|
||||||
|
$str .= ($short_time_name ? $short_name[$truncate_after] : $truncate_after);
|
||||||
|
} else {
|
||||||
|
$str .= ($short_time_name ? $short_name['seconds'] : 'seconds');
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
} elseif (count($formatted) == 1) {
|
||||||
|
return $negative .
|
||||||
|
($add_zero_seconds ?
|
||||||
|
'0'
|
||||||
|
. ($name_space_seperator ? ' ' : '')
|
||||||
|
. ($short_time_name ? $short_name['seconds'] : 'seconds')
|
||||||
|
. ' '
|
||||||
|
: ''
|
||||||
|
)
|
||||||
|
. $formatted[0];
|
||||||
|
} elseif ($natural_seperator === false) {
|
||||||
|
return $negative . implode(' ', $formatted);
|
||||||
|
} else {
|
||||||
|
$str = implode(', ', array_slice($formatted, 0, -1));
|
||||||
|
if (!empty($formatted[count($formatted) - 1])) {
|
||||||
|
$str .= ' and ' . $formatted[count($formatted) - 1];
|
||||||
|
}
|
||||||
|
return $negative . $str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -34,7 +34,7 @@ $db->log->debug('START', '=============================>');
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: DB dbReturn';
|
$PAGE_NAME = 'TEST CLASS: DB dbReturn';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><a href="class_test.db.php">Class Test DB</a></div>';
|
print '<div><a href="class_test.db.php">Class Test DB</a></div>';
|
||||||
@@ -56,7 +56,9 @@ print "<b>dbReturn CACHE tests</b><br>";
|
|||||||
$db->dbExec("DELETE FROM test_db_return");
|
$db->dbExec("DELETE FROM test_db_return");
|
||||||
$db->dbExec("INSERT INTO test_db_return (uid, data) VALUES ('A1', 'Test A'), ('B1', 'Test B')");
|
$db->dbExec("INSERT INTO test_db_return (uid, data) VALUES ('A1', 'Test A'), ('B1', 'Test B')");
|
||||||
// read query to use
|
// read query to use
|
||||||
$q_db_ret = "SELECT * FROM test_db_return ORDER BY uid";
|
$q_db_ret = <<<SQL
|
||||||
|
SELECT * FROM test_db_return ORDER BY uid
|
||||||
|
SQL;
|
||||||
|
|
||||||
RunningTime::hrRunningTime();
|
RunningTime::hrRunningTime();
|
||||||
|
|
||||||
@@ -157,4 +159,15 @@ $db->dbCacheReset($q_db_ret);
|
|||||||
print "<br>";
|
print "<br>";
|
||||||
print "Overall Run time: " . RunningTime::hrRunningTimeFromStart() . "<br>";
|
print "Overall Run time: " . RunningTime::hrRunningTimeFromStart() . "<br>";
|
||||||
|
|
||||||
|
print "<br>";
|
||||||
|
print "PARAM TEST RUN<br>";
|
||||||
|
// PARAM
|
||||||
|
$q_db_ret = <<<SQL
|
||||||
|
SELECT * FROM test_db_return WHERE uid = $1
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
while (is_array($res = $db->dbReturnParams($q_db_ret, ['A1'], $db::NO_CACHE, true))) {
|
||||||
|
print "ROW: " . Support::printAr($res) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
+24
-10
@@ -35,12 +35,13 @@ $db->log->debug('START', '=============================>');
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: DB';
|
$PAGE_NAME = 'TEST CLASS: DB';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><a href="class_test.db.type.php">Class Test DB Types</a></div>';
|
print '<div><a href="class_test.db.type.php">Class Test DB row type convert to PHP type</a></div>';
|
||||||
|
print '<div><a href="class_test.db.query-placeholder.php">Class Test DB Query Placeholder convert</a></div>';
|
||||||
print '<div><a href="class_test.db.dbReturn.php">Class Test DB dbReturn</a></div>';
|
print '<div><a href="class_test.db.dbReturn.php">Class Test DB dbReturn</a></div>';
|
||||||
print '<div><a href="class_test.db.single.php">Class Test DB Single Aciont</a></div>';
|
print '<div><a href="class_test.db.single.php">Class Test DB Single Query tests</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|
||||||
print "LOGFILE NAME: " . $db->log->getLogFile() . "<br>";
|
print "LOGFILE NAME: " . $db->log->getLogFile() . "<br>";
|
||||||
@@ -549,11 +550,13 @@ print "</pre>";
|
|||||||
|
|
||||||
print "<b>PREPARE QUERIES</b><br>";
|
print "<b>PREPARE QUERIES</b><br>";
|
||||||
// READ PREPARE
|
// READ PREPARE
|
||||||
$q_prep = "SELECT test_foo_id, test, some_bool, string_a, number_a, "
|
$q_prep = <<<SQL
|
||||||
. "number_a_numeric, some_time "
|
SELECT test_foo_id, test, some_bool, string_a, number_a,
|
||||||
. "FROM test_foo "
|
number_a_numeric, some_time
|
||||||
. "WHERE test = $1 "
|
FROM test_foo
|
||||||
. "ORDER BY test_foo_id DESC LIMIT 5";
|
WHERE test = $1
|
||||||
|
ORDER BY test_foo_id DESC LIMIT 5
|
||||||
|
SQL;
|
||||||
if ($db->dbPrepare('sel_test_foo', $q_prep) === false) {
|
if ($db->dbPrepare('sel_test_foo', $q_prep) === false) {
|
||||||
print "Error in sel_test_foo prepare<br>";
|
print "Error in sel_test_foo prepare<br>";
|
||||||
} else {
|
} else {
|
||||||
@@ -681,16 +684,27 @@ echo "<hr>";
|
|||||||
$db_pgb = new CoreLibs\DB\IO($DB_CONFIG['test_pgbouncer'] ?? [], $log);
|
$db_pgb = new CoreLibs\DB\IO($DB_CONFIG['test_pgbouncer'] ?? [], $log);
|
||||||
print "[PGB] DBINFO: " . $db_pgb->dbInfo() . "<br>";
|
print "[PGB] DBINFO: " . $db_pgb->dbInfo() . "<br>";
|
||||||
if ($db->dbPrepare('pgb_sel_test_foo', $q_prep) === false) {
|
if ($db->dbPrepare('pgb_sel_test_foo', $q_prep) === false) {
|
||||||
print "[PGB] [1] Error in pgb_sel_test_foo prepare<br>";
|
print "[PGB] [1] Warning in pgb_sel_test_foo prepare<br>";
|
||||||
} else {
|
} else {
|
||||||
print "[PGB] [1] pgb_sel_test_foo prepare OK<br>";
|
print "[PGB] [1] pgb_sel_test_foo prepare OK<br>";
|
||||||
}
|
}
|
||||||
// second prepare
|
// second prepare
|
||||||
if ($db->dbPrepare('pgb_sel_test_foo', $q_prep) === false) {
|
if ($db->dbPrepare('pgb_sel_test_foo', $q_prep) === false) {
|
||||||
print "[PGB] [2] Error in pgb_sel_test_foo prepare<br>";
|
print "[PGB] [2] Warning in pgb_sel_test_foo prepare<br>";
|
||||||
} else {
|
} else {
|
||||||
print "[PGB] [2] pgb_sel_test_foo prepare OK<br>";
|
print "[PGB] [2] pgb_sel_test_foo prepare OK<br>";
|
||||||
}
|
}
|
||||||
|
// same statment name, different query
|
||||||
|
if (
|
||||||
|
$db->dbPrepare('pgb_sel_test_foo', <<<SQL
|
||||||
|
SELECT * FROM test_foo WHERE test = $1
|
||||||
|
ORDER BY test_foo_id DESC LIMIT 5
|
||||||
|
SQL) === false
|
||||||
|
) {
|
||||||
|
print "[PGB] [3] Error in pgb_sel_test_foo prepare<br>";
|
||||||
|
} else {
|
||||||
|
print "[PGB] [3] pgb_sel_test_foo prepare OK<br>";
|
||||||
|
}
|
||||||
$db_pgb->dbClose();
|
$db_pgb->dbClose();
|
||||||
|
|
||||||
# db write class test
|
# db write class test
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
// turn on all error reporting
|
||||||
|
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
// basic class test file
|
||||||
|
define('USE_DATABASE', true);
|
||||||
|
// sample config
|
||||||
|
require 'config.php';
|
||||||
|
// define log file id
|
||||||
|
$LOG_FILE_ID = 'classTest-db-query-placeholder';
|
||||||
|
ob_end_flush();
|
||||||
|
|
||||||
|
use CoreLibs\Debug\Support;
|
||||||
|
// use CoreLibs\DB\Support\ConvertPlaceholder;
|
||||||
|
|
||||||
|
$log = new CoreLibs\Logging\Logging([
|
||||||
|
'log_folder' => BASE . LOG,
|
||||||
|
'log_file_id' => $LOG_FILE_ID,
|
||||||
|
'log_per_date' => true,
|
||||||
|
]);
|
||||||
|
// db connection and attach logger
|
||||||
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
|
$db->log->debug('START', '=============================>');
|
||||||
|
|
||||||
|
$PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDER';
|
||||||
|
print "<!DOCTYPE html>";
|
||||||
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
|
print "<body>";
|
||||||
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|
||||||
|
print "LOGFILE NAME: " . $db->log->getLogFile() . "<br>";
|
||||||
|
print "LOGFILE ID: " . $db->log->getLogFileId() . "<br>";
|
||||||
|
print "DBINFO: " . $db->dbInfo() . "<br>";
|
||||||
|
// DB client encoding
|
||||||
|
print "DB client encoding: " . $db->dbGetEncoding() . "<br>";
|
||||||
|
print "DB search path: " . $db->dbGetSchema() . "<br>";
|
||||||
|
|
||||||
|
$to_db_version = '15.2';
|
||||||
|
print "VERSION DB: " . $db->dbVersion() . "<br>";
|
||||||
|
print "SERVER ENCODING: " . $db->dbVersionInfo('server_encoding') . "<br>";
|
||||||
|
if (($dbh = $db->dbGetDbh()) instanceof \PgSql\Connection) {
|
||||||
|
print "ALL OUTPUT [TEST]: <pre>" . print_r(pg_version($dbh), true) . "</pre><br>";
|
||||||
|
} else {
|
||||||
|
print "NO DB HANDLER<br>";
|
||||||
|
}
|
||||||
|
// turn on debug replace for placeholders
|
||||||
|
$db->dbSetDebugReplacePlaceholder(true);
|
||||||
|
|
||||||
|
print "<b>TRUNCATE test_foo</b><br>";
|
||||||
|
$db->dbExec("TRUNCATE test_foo");
|
||||||
|
|
||||||
|
$uniqid = \CoreLibs\Create\Uids::uniqIdShort();
|
||||||
|
$binary_data = $db->dbEscapeBytea(file_get_contents('class_test.db.php') ?: '');
|
||||||
|
$query_params = [
|
||||||
|
$uniqid,
|
||||||
|
true,
|
||||||
|
'STRING A',
|
||||||
|
2,
|
||||||
|
2.5,
|
||||||
|
1,
|
||||||
|
date('H:m:s'),
|
||||||
|
date('Y-m-d H:i:s'),
|
||||||
|
json_encode(['a' => 'string', 'b' => 1, 'c' => 1.5, 'f' => true, 'g' => ['a', 1, 1.5]]),
|
||||||
|
null,
|
||||||
|
'{"a", "b"}',
|
||||||
|
'{1,2}',
|
||||||
|
'{"(array Text A, 5, 8.8)","(array Text B, 10, 15.2)"}',
|
||||||
|
'("Text", 4, 6.3)',
|
||||||
|
$binary_data
|
||||||
|
];
|
||||||
|
|
||||||
|
$query_insert = <<<SQL
|
||||||
|
INSERT INTO test_foo (
|
||||||
|
test, some_bool, string_a, number_a, number_a_numeric, smallint_a,
|
||||||
|
some_time, some_timestamp, json_string, null_var,
|
||||||
|
array_char_1, array_int_1,
|
||||||
|
array_composite,
|
||||||
|
composite_item,
|
||||||
|
some_binary
|
||||||
|
) VALUES (
|
||||||
|
$1, $2, $3, $4, $5, $6,
|
||||||
|
$7, $8, $9, $10,
|
||||||
|
$11, $12,
|
||||||
|
$13,
|
||||||
|
$14,
|
||||||
|
$15
|
||||||
|
)
|
||||||
|
RETURNING
|
||||||
|
test_foo_id,
|
||||||
|
test, some_bool, string_a, number_a, number_a_numeric, smallint_a,
|
||||||
|
some_time, some_timestamp, json_string, null_var,
|
||||||
|
array_char_1, array_int_1,
|
||||||
|
array_composite,
|
||||||
|
composite_item,
|
||||||
|
some_binary
|
||||||
|
SQL;
|
||||||
|
$status = $db->dbExecParams($query_insert, $query_params);
|
||||||
|
echo "<b>*</b><br>";
|
||||||
|
echo "INSERT ALL COLUMN TYPES: "
|
||||||
|
. Support::printToString($query_params) . " |<br>"
|
||||||
|
. "QUERY: " . $db->dbGetQuery() . " |<br>"
|
||||||
|
. "PRIMARY KEY: " . Support::printToString($db->dbGetInsertPK()) . " |<br>"
|
||||||
|
. "RETURNING EXT: <pre>" . print_r($db->dbGetReturningExt(), true) . "</pre> |<br>"
|
||||||
|
. "RETURNING RETURN: <pre>" . print_r($db->dbGetReturningArray(), true) . "<pre> |<br>"
|
||||||
|
. "ERROR: " . $db->dbGetLastError(true) . "<br>";
|
||||||
|
echo "<hr>";
|
||||||
|
|
||||||
|
// test connectors: = , <> () for query detection
|
||||||
|
|
||||||
|
// convert placeholder tests
|
||||||
|
// ? -> $n
|
||||||
|
// :name -> $n
|
||||||
|
|
||||||
|
// other way around (just visual)
|
||||||
|
$test_queries = [
|
||||||
|
'skip' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
SELECT test, string_a, number_a
|
||||||
|
FROM test_foo
|
||||||
|
SQL,
|
||||||
|
'params' => [],
|
||||||
|
'direction' => 'pg',
|
||||||
|
],
|
||||||
|
'a?' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
INSERT INTO test_foo (
|
||||||
|
test, string_a, number_a
|
||||||
|
) VALUES (
|
||||||
|
?, ?, ?
|
||||||
|
)
|
||||||
|
SQL,
|
||||||
|
'params' => [\CoreLibs\Create\Uids::uniqIdShort(), 'string A-1', 1234],
|
||||||
|
'direction' => 'pg',
|
||||||
|
],
|
||||||
|
'b:' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
INSERT INTO test_foo (
|
||||||
|
test, string_a, number_a
|
||||||
|
) VALUES (
|
||||||
|
:test, :string_a, :number_a
|
||||||
|
)
|
||||||
|
SQL,
|
||||||
|
'params' => [
|
||||||
|
':test' => \CoreLibs\Create\Uids::uniqIdShort(),
|
||||||
|
':string_a' => 'string B-1',
|
||||||
|
':number_a' => 5678
|
||||||
|
],
|
||||||
|
'direction' => 'pg',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$db->dbSetConvertPlaceholder(true);
|
||||||
|
foreach ($test_queries as $info => $data) {
|
||||||
|
$query = $data['query'];
|
||||||
|
$params = $data['params'];
|
||||||
|
$direction = $data['direction'];
|
||||||
|
// print "[$info] Convert: "
|
||||||
|
// . Support::printAr(ConvertPlaceholder::convertPlaceholderInQuery($query, $params, $direction))
|
||||||
|
// . "<br>";
|
||||||
|
if ($db->dbCheckQueryForSelect($query)) {
|
||||||
|
$row = $db->dbReturnRowParams($query, $params);
|
||||||
|
print "[$info] SELECT: " . Support::prAr($row) . "<br>";
|
||||||
|
} else {
|
||||||
|
$db->dbExecParams($query, $params);
|
||||||
|
}
|
||||||
|
print "[$info] " . Support::printAr($db->dbGetPlaceholderConverted()) . "<br>";
|
||||||
|
echo "<hr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "dbReturn read: <br>";
|
||||||
|
while (
|
||||||
|
is_array($res = $db->dbReturnParams(
|
||||||
|
<<<SQL
|
||||||
|
SELECT test, string_a, number_a
|
||||||
|
FROM test_foo
|
||||||
|
WHERE string_a = ?
|
||||||
|
SQL,
|
||||||
|
['string A-1']
|
||||||
|
))
|
||||||
|
) {
|
||||||
|
print "RES: " . Support::prAr($res) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "CursorExt: " . Support::prAr($db->dbGetCursorExt(<<<SQL
|
||||||
|
SELECT test, string_a, number_a
|
||||||
|
FROM test_foo
|
||||||
|
WHERE string_a = ?
|
||||||
|
SQL, ['string A-1']));
|
||||||
|
|
||||||
|
$res = $db->dbReturnRowParams(<<<SQL
|
||||||
|
SELECT test, string_a, number_a
|
||||||
|
FROM test_foo
|
||||||
|
WHERE string_a = $1
|
||||||
|
SQL, []);
|
||||||
|
print "PL: " . Support::PrAr($db->dbGetPlaceholderConverted()) . "<br>";
|
||||||
|
|
||||||
|
print "</body></html>";
|
||||||
|
$db->log->debug('DEBUGEND', '==================================== [END]');
|
||||||
|
|
||||||
|
// __END__
|
||||||
@@ -16,10 +16,10 @@ define('USE_DATABASE', true);
|
|||||||
// sample config
|
// sample config
|
||||||
require 'config.php';
|
require 'config.php';
|
||||||
// define log file id
|
// define log file id
|
||||||
$LOG_FILE_ID = 'classTest-db-single';
|
$LOG_FILE_ID = 'classTest-db-query-placeholders';
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
use CoreLibs\Debug\Support;
|
// use CoreLibs\Debug\Support;
|
||||||
|
|
||||||
$log = new CoreLibs\Logging\Logging([
|
$log = new CoreLibs\Logging\Logging([
|
||||||
'log_folder' => BASE . LOG,
|
'log_folder' => BASE . LOG,
|
||||||
@@ -30,9 +30,9 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
|
||||||
$db->log->debug('START', '=============================>');
|
$db->log->debug('START', '=============================>');
|
||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: DB SINGLE';
|
$PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDERS';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -65,63 +65,6 @@ function testDBS(\CoreLibs\DB\IO $dbc): void
|
|||||||
$dbc->dbReturnRow("SELECT test FROM test_foo LIMIT 1");
|
$dbc->dbReturnRow("SELECT test FROM test_foo LIMIT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
$uniqid = \CoreLibs\Create\Uids::uniqIdShort();
|
|
||||||
$binary_data = $db->dbEscapeBytea(file_get_contents('class_test.db.php') ?: '');
|
|
||||||
$query_params = [
|
|
||||||
$uniqid,
|
|
||||||
true,
|
|
||||||
'STRING A',
|
|
||||||
2,
|
|
||||||
2.5,
|
|
||||||
1,
|
|
||||||
date('H:m:s'),
|
|
||||||
date('Y-m-d H:m:s'),
|
|
||||||
json_encode(['a' => 'string', 'b' => 1, 'c' => 1.5, 'f' => true, 'g' => ['a', 1, 1.5]]),
|
|
||||||
null,
|
|
||||||
'{"a", "b"}',
|
|
||||||
'{1,2}',
|
|
||||||
'{"(array Text A, 5, 8.8)","(array Text B, 10, 15.2)"}',
|
|
||||||
'("Text", 4, 6.3)',
|
|
||||||
$binary_data
|
|
||||||
];
|
|
||||||
|
|
||||||
$query_insert = <<<SQL
|
|
||||||
INSERT INTO test_foo (
|
|
||||||
test, some_bool, string_a, number_a, number_a_numeric, smallint_a,
|
|
||||||
some_time, some_timestamp, json_string, null_var,
|
|
||||||
array_char_1, array_int_1,
|
|
||||||
array_composite,
|
|
||||||
composite_item,
|
|
||||||
some_binary
|
|
||||||
) VALUES (
|
|
||||||
$1, $2, $3, $4, $5, $6,
|
|
||||||
$7, $8, $9, $10,
|
|
||||||
$11, $12,
|
|
||||||
$13,
|
|
||||||
$14,
|
|
||||||
$15
|
|
||||||
)
|
|
||||||
SQL;
|
|
||||||
$status = $db->dbExecParams($query_insert, $query_params);
|
|
||||||
$query_select = <<<SQL
|
|
||||||
SELECT
|
|
||||||
test_foo_id,
|
|
||||||
test, some_bool, string_a, number_a, number_a_numeric, smallint_a,
|
|
||||||
number_real, number_double, number_serial,
|
|
||||||
some_time, some_timestamp, json_string, null_var,
|
|
||||||
array_char_1, array_char_2, array_int_1, array_int_2, array_composite,
|
|
||||||
composite_item, (composite_item).*
|
|
||||||
some_binary
|
|
||||||
FROM
|
|
||||||
test_foo
|
|
||||||
WHERE
|
|
||||||
test = $1;
|
|
||||||
SQL;
|
|
||||||
$res = $db->dbReturnRowParams($query_select, [$uniqid]);
|
|
||||||
if (is_array($res)) {
|
|
||||||
var_dump($res);
|
|
||||||
}
|
|
||||||
|
|
||||||
testDBS($db);
|
testDBS($db);
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ $db->log->debug('START', '=============================>');
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: DB COLUMN TYPES';
|
$PAGE_NAME = 'TEST CLASS: DB COLUMN TYPES';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ $debug_logging_class = 'CoreLibs\Debug\LoggingLegacy';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: DEBUG';
|
$PAGE_NAME = 'TEST CLASS: DEBUG';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -170,6 +170,8 @@ class TestL
|
|||||||
{
|
{
|
||||||
print "* GETCALLERCLASS(INSIDE CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
print "* GETCALLERCLASS(INSIDE CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
||||||
print "* GETCALLERTOPCLASS(INSIDE CLASS): " . \CoreLibs\Debug\Support::getCallerTopLevelClass() . "<br>";
|
print "* GETCALLERTOPCLASS(INSIDE CLASS): " . \CoreLibs\Debug\Support::getCallerTopLevelClass() . "<br>";
|
||||||
|
print "* GETCALLSTACK(INSIDE CLASS): <pre>"
|
||||||
|
. DebugSupport::prAr(\CoreLibs\Debug\Support::getCallStack()) . "</pre><br>";
|
||||||
$this->log->debug('TESTL', 'Logging in class testL' . ($ts !== null ? ': ' . $ts : ''));
|
$this->log->debug('TESTL', 'Logging in class testL' . ($ts !== null ? ': ' . $ts : ''));
|
||||||
$this->log->debug('TESTL', 'Some other message');
|
$this->log->debug('TESTL', 'Some other message');
|
||||||
return true;
|
return true;
|
||||||
@@ -193,6 +195,8 @@ class TestR extends TestL
|
|||||||
{
|
{
|
||||||
print "** GETCALLERCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
print "** GETCALLERCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
||||||
print "** GETCALLERTOPCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerTopLevelClass() . "<br>";
|
print "** GETCALLERTOPCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerTopLevelClass() . "<br>";
|
||||||
|
print "** GETCALLSTACK(INSIDE EXTND CLASS): <pre>"
|
||||||
|
. DebugSupport::prAr(\CoreLibs\Debug\Support::getCallStack()) . "</pre><br>";
|
||||||
$this->log->debug('TESTR', 'Logging in class testR (extends testL)');
|
$this->log->debug('TESTR', 'Logging in class testR (extends testL)');
|
||||||
$this->test('TESTR INSIDE');
|
$this->test('TESTR INSIDE');
|
||||||
$this->log->debug('TESTR', 'Array: '
|
$this->log->debug('TESTR', 'Array: '
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
|
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ $chk_enc = 'CoreLibs\Check\Encoding';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: ENCODING (CHECK/CONVERT/MIME)';
|
$PAGE_NAME = 'TEST CLASS: ENCODING (CHECK/CONVERT/MIME)';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: ENCRYPTION';
|
$PAGE_NAME = 'TEST CLASS: ENCRYPTION';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -40,16 +40,33 @@ $key = CreateKey::generateRandomKey();
|
|||||||
print "Secret Key: " . $key . "<br>";
|
print "Secret Key: " . $key . "<br>";
|
||||||
|
|
||||||
$string = "I a some deep secret";
|
$string = "I a some deep secret";
|
||||||
$encrypted = SymmetricEncryption::encrypt($string, $key);
|
//
|
||||||
$decrypted = SymmetricEncryption::decrypt($encrypted, $key);
|
$crypt = new SymmetricEncryption($key);
|
||||||
|
$encrypted = $crypt->encrypt($string);
|
||||||
|
$decrypted = $crypt->decrypt($encrypted);
|
||||||
|
print "[C] Encrypted: " . $encrypted . "<br>";
|
||||||
|
print "[C] Decrytped: " . $decrypted . "<br>";
|
||||||
|
$encrypted = SymmetricEncryption::getInstance($key)->encrypt($string);
|
||||||
|
$decrypted = SymmetricEncryption::getInstance($key)->decrypt($encrypted);
|
||||||
|
print "[S] Original: " . $string . "<br>";
|
||||||
|
print "[S] Encrypted: " . $encrypted . "<br>";
|
||||||
|
print "[S] Decrytped: " . $decrypted . "<br>";
|
||||||
|
$encrypted = SymmetricEncryption::encryptKey($string, $key);
|
||||||
|
$decrypted = SymmetricEncryption::decryptKey($encrypted, $key);
|
||||||
|
print "[SS] Encrypted: " . $encrypted . "<br>";
|
||||||
|
print "[SS] Decrytped: " . $decrypted . "<br>";
|
||||||
|
|
||||||
print "Original: " . $string . "<br>";
|
print "<br>INIT KEY MISSING<br>";
|
||||||
print "Encrypted: " . $encrypted . "<br>";
|
try {
|
||||||
print "Decrytped: " . $decrypted . "<br>";
|
$crypt = new SymmetricEncryption();
|
||||||
|
$encrypted = $crypt->decrypt($string);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
print("Error: " . $e->getMessage() . "<br>");
|
||||||
|
}
|
||||||
|
|
||||||
print "<br>WRONG CIPHERTEXT<br>";
|
print "<br>WRONG CIPHERTEXT<br>";
|
||||||
try {
|
try {
|
||||||
$decrypted = SymmetricEncryption::decrypt('flupper', $key);
|
$decrypted = SymmetricEncryption::decryptKey('flupper', $key);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
print "Error: " . $e->getMessage() . "<br>";
|
print "Error: " . $e->getMessage() . "<br>";
|
||||||
}
|
}
|
||||||
@@ -57,7 +74,7 @@ try {
|
|||||||
print "<br>SHORT and WRONG KEY<br>";
|
print "<br>SHORT and WRONG KEY<br>";
|
||||||
$key = 'wrong_key';
|
$key = 'wrong_key';
|
||||||
try {
|
try {
|
||||||
$encrypted = SymmetricEncryption::encrypt($string, $key);
|
$encrypted = SymmetricEncryption::encryptKey($string, $key);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
print "Error: " . $e->getMessage() . "<br>";
|
print "Error: " . $e->getMessage() . "<br>";
|
||||||
}
|
}
|
||||||
@@ -65,7 +82,7 @@ try {
|
|||||||
print "<br>INVALID HEX KEY<br>";
|
print "<br>INVALID HEX KEY<br>";
|
||||||
$key = '1cabd5cba9e042f12522f4ff2de5c31d233b';
|
$key = '1cabd5cba9e042f12522f4ff2de5c31d233b';
|
||||||
try {
|
try {
|
||||||
$encrypted = SymmetricEncryption::encrypt($string, $key);
|
$encrypted = SymmetricEncryption::encryptKey($string, $key);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
print "Error: " . $e->getMessage() . "<br>";
|
print "Error: " . $e->getMessage() . "<br>";
|
||||||
}
|
}
|
||||||
@@ -73,25 +90,21 @@ try {
|
|||||||
print "<br>WRONG KEY TO DECRYPT<br>";
|
print "<br>WRONG KEY TO DECRYPT<br>";
|
||||||
$key = CreateKey::generateRandomKey();
|
$key = CreateKey::generateRandomKey();
|
||||||
$string = "I a some deep secret";
|
$string = "I a some deep secret";
|
||||||
$encrypted = SymmetricEncryption::encrypt($string, $key);
|
$encrypted = SymmetricEncryption::encryptKey($string, $key);
|
||||||
$key = CreateKey::generateRandomKey();
|
|
||||||
try {
|
|
||||||
$decrypted = SymmetricEncryption::decrypt($encrypted, $key);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
print "Error: " . $e->getMessage() . "<br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "<br>WRONG KEY TO DECRYPT<br>";
|
|
||||||
$key = CreateKey::generateRandomKey();
|
|
||||||
$string = "I a some deep secret";
|
|
||||||
$encrypted = SymmetricEncryption::encrypt($string, $key);
|
|
||||||
$key = 'wrong_key';
|
$key = 'wrong_key';
|
||||||
try {
|
try {
|
||||||
$decrypted = SymmetricEncryption::decrypt($encrypted, $key);
|
$decrypted = SymmetricEncryption::decryptKey($encrypted, $key);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
print "Error: " . $e->getMessage() . "<br>";
|
print "Error: " . $e->getMessage() . "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// echo "<hr>";
|
||||||
|
// $key = CreateKey::generateRandomKey();
|
||||||
|
// $se = new SymmetricEncryption($key);
|
||||||
|
// $string = "I a some deep secret";
|
||||||
|
// $encrypted = $se->encrypt($string);
|
||||||
|
// $decrypted = $se->decrypt($encrypted);
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: ERROR MSG';
|
$PAGE_NAME = 'TEST CLASS: ERROR MSG';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -45,6 +45,8 @@ $em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug');
|
|||||||
$em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug', 'target-id', 'other-style');
|
$em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug', 'target-id', 'other-style');
|
||||||
$em->setErrorMsg('123', 'error', 'msg this is bad, logged always', log_error:true);
|
$em->setErrorMsg('123', 'error', 'msg this is bad, logged always', log_error:true);
|
||||||
$em->setErrorMsg('123', 'error', 'msg this is bad, never logged', log_error:false);
|
$em->setErrorMsg('123', 'error', 'msg this is bad, never logged', log_error:false);
|
||||||
|
$em->setErrorMsg('500', 'warning', 'This is perhaps not super good, logged_always', log_warning:true);
|
||||||
|
$em->setErrorMsg('500', 'warning', 'This is perhaps not super good, logged_never', log_warning:false);
|
||||||
$em->setErrorMsg('1000', 'info', 'This is good');
|
$em->setErrorMsg('1000', 'info', 'This is good');
|
||||||
$em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)');
|
$em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)');
|
||||||
$em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency');
|
$em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency');
|
||||||
@@ -59,6 +61,8 @@ print "ErrorsIds: <pre>" . $log->prAr($em->getErrorIds()) . "</pre>";
|
|||||||
print "Errors: <pre>" . $log->prAr($em->getErrorMsg()) . "</pre>";
|
print "Errors: <pre>" . $log->prAr($em->getErrorMsg()) . "</pre>";
|
||||||
print "JumpTargets: <pre>" . $log->prAr($em->getJumpTarget()) . "</pre>";
|
print "JumpTargets: <pre>" . $log->prAr($em->getJumpTarget()) . "</pre>";
|
||||||
|
|
||||||
|
print "IS info > ok: " . ml::fromName('info')->isHigherThan(ml::ok) . "<br>";
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
$log->debug('[END]', '==========================================>');
|
$log->debug('[END]', '==========================================>');
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: FILE';
|
$PAGE_NAME = 'TEST CLASS: FILE';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -37,6 +37,7 @@ $file = '/some/path/to/some/file.txt';
|
|||||||
print "GETFILENAMEENDING: $file: " . File::getFilenameEnding($file) . "<br>";
|
print "GETFILENAMEENDING: $file: " . File::getFilenameEnding($file) . "<br>";
|
||||||
$file = getcwd() . DIRECTORY_SEPARATOR . 'class_test.file.php';
|
$file = getcwd() . DIRECTORY_SEPARATOR . 'class_test.file.php';
|
||||||
print "GETLINESFROMFILE: $file: " . File::getLinesFromFile($file) . "<br>";
|
print "GETLINESFROMFILE: $file: " . File::getLinesFromFile($file) . "<br>";
|
||||||
|
print "MIMEINFO: $file: " . File::getMimeType($file) . "<br>";
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ $hash_class = 'CoreLibs\Create\Hash';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: HASH';
|
$PAGE_NAME = 'TEST CLASS: HASH';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -35,19 +35,21 @@ $elements_class = 'CoreLibs\Output\Form\Elements';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
|
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|
||||||
$string = "Something < = > Other <br> Next line";
|
$string = "Something < = > Other <br> Next line and Quotes '\"";
|
||||||
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . "<br>";
|
echo "String: <pre>$string</pre><br>";
|
||||||
|
$log->debug('HTMLENT', Html::htmlent($string));
|
||||||
|
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . " (" . htmlentities($string) . ")<br>";
|
||||||
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>";
|
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>";
|
||||||
$date_str = [2021, 5, 1, 11, 10];
|
$date_str = [2021, 5, 1, 11, 10];
|
||||||
print "PRINTDATETIME: "
|
print "PRINTDATETIME: "
|
||||||
. $_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "<br>";
|
. $_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "<br>";
|
||||||
// STATIC
|
// STATIC
|
||||||
$string = "Something < = > Other <br> Next line";
|
// $string = "Something < = > Other <br> Next line and Quotes '\"";
|
||||||
print "S::HTMLENT: " . Html::htmlent($string) . ": " . $html_class::htmlent($string) . "<br>";
|
print "S::HTMLENT: " . Html::htmlent($string) . ": " . $html_class::htmlent($string) . "<br>";
|
||||||
print "S::REMOVELB: " . Html::htmlent($string) . ": " . $html_class::removeLB($string) . "<br>";
|
print "S::REMOVELB: " . Html::htmlent($string) . ": " . $html_class::removeLB($string) . "<br>";
|
||||||
$date_str = [2021, 5, 1, 11, 10];
|
$date_str = [2021, 5, 1, 11, 10];
|
||||||
@@ -67,8 +69,10 @@ $checked_list = [
|
|||||||
['foo', ['bar']],
|
['foo', ['bar']],
|
||||||
];
|
];
|
||||||
foreach ($checked_list as $check) {
|
foreach ($checked_list as $check) {
|
||||||
print "CHECKED(0): $check[0]: " . Html::checked($check[1], $check[0]) . "<br>";
|
print "CHECKED(0): " . $check[0] . " -> " . print_r($check[1], true) . ": "
|
||||||
print "CHECKED(1): $check[0]: " . Html::checked($check[1], $check[0], Html::CHECKED) . "<br>";
|
. Html::checked($check[1], $check[0]) . "<br>";
|
||||||
|
print "CHECKED(1): " . $check[0] . " -> " . print_r($check[1], true) . ": "
|
||||||
|
. Html::checked($check[1], $check[0], Html::CHECKED) . "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// magic link creation test
|
// magic link creation test
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: HTML BUILD: BLOCK';
|
$PAGE_NAME = 'TEST CLASS: HTML BUILD: BLOCK';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: HTML BUILD';
|
$PAGE_NAME = 'TEST CLASS: HTML BUILD';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: HTML BUILD: STRING REPLACE';
|
$PAGE_NAME = 'TEST CLASS: HTML BUILD: STRING REPLACE';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ $image_class = 'CoreLibs\Output\Image';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: IMAGE';
|
$PAGE_NAME = 'TEST CLASS: IMAGE';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -41,9 +41,9 @@ print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
|||||||
$thumb_width = 250;
|
$thumb_width = 250;
|
||||||
$thumb_height = 300;
|
$thumb_height = 300;
|
||||||
// class
|
// class
|
||||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture_square.jpg';
|
$image = BASE . CONTENT_PATH . LAYOUT . IMAGES . 'no_picture_square.jpg';
|
||||||
// folders
|
// folders
|
||||||
$cache_folder = BASE . LAYOUT . CONTENT_PATH . CACHE . IMAGES;
|
$cache_folder = BASE . CONTENT_PATH . LAYOUT . CACHE . IMAGES;
|
||||||
$web_folder = LAYOUT . CACHE . IMAGES;
|
$web_folder = LAYOUT . CACHE . IMAGES;
|
||||||
// rotate image first
|
// rotate image first
|
||||||
try {
|
try {
|
||||||
@@ -58,7 +58,7 @@ echo "<div>CLASS->CREATETHUMBNAILSIMPLE: "
|
|||||||
. basename($image) . ": WIDTH: $thumb_width<br><img src="
|
. basename($image) . ": WIDTH: $thumb_width<br><img src="
|
||||||
. $_image->createThumbnailSimple($image, $thumb_width, 0, $cache_folder, $web_folder) . "></div>";
|
. $_image->createThumbnailSimple($image, $thumb_width, 0, $cache_folder, $web_folder) . "></div>";
|
||||||
// static
|
// static
|
||||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture.jpg';
|
$image = BASE . CONTENT_PATH . LAYOUT . IMAGES . 'no_picture.jpg';
|
||||||
// rotate image first
|
// rotate image first
|
||||||
try {
|
try {
|
||||||
$image_class::correctImageOrientation($image);
|
$image_class::correctImageOrientation($image);
|
||||||
@@ -94,7 +94,7 @@ $images = array(
|
|||||||
// return mime type ala mimetype
|
// return mime type ala mimetype
|
||||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||||
foreach ($images as $image) {
|
foreach ($images as $image) {
|
||||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . $image;
|
$image = BASE . CONTENT_PATH . LAYOUT . IMAGES . $image;
|
||||||
list ($height, $width, $img_type) = \CoreLibs\Convert\SetVarType::setArray(getimagesize($image));
|
list ($height, $width, $img_type) = \CoreLibs\Convert\SetVarType::setArray(getimagesize($image));
|
||||||
echo "<div><b>IMAGE INFO</b>: " . $height . "x" . $width . ", TYPE: "
|
echo "<div><b>IMAGE INFO</b>: " . $height . "x" . $width . ", TYPE: "
|
||||||
. \CoreLibs\Debug\Support::dumpVar($img_type) . " [" . $finfo->file($image) . "]</div>";
|
. \CoreLibs\Debug\Support::dumpVar($img_type) . " [" . $finfo->file($image) . "]</div>";
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ $json_class = 'CoreLibs\Convert\Json';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: JSON';
|
$PAGE_NAME = 'TEST CLASS: JSON';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ ob_end_flush();
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: LANG';
|
$PAGE_NAME = 'TEST CLASS: LANG';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: LOGGING';
|
$PAGE_NAME = 'TEST CLASS: LOGGING';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ $login->loginMainCall();
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: LOGIN';
|
$PAGE_NAME = 'TEST CLASS: LOGIN';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ $math_class = 'CoreLibs\Convert\Math';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: MATH';
|
$PAGE_NAME = 'TEST CLASS: MATH';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: MEMORY USAGE';
|
$PAGE_NAME = 'TEST CLASS: MEMORY USAGE';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ $_mime = new CoreLibs\Convert\MimeAppName();
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: MIME';
|
$PAGE_NAME = 'TEST CLASS: MIME';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ $form = new CoreLibs\Output\Form\Generate(
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: FORM GENERATE';
|
$PAGE_NAME = 'TEST CLASS: FORM GENERATE';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ $password_class = 'CoreLibs\Security\Password';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: PASSWORD';
|
$PAGE_NAME = 'TEST CLASS: PASSWORD';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -63,15 +63,16 @@ $backend->db->dbInfo(true);
|
|||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>TEST CLASS</title><head>";
|
print "<html><head><title>TEST CLASS</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
|
|
||||||
// key: file name, value; name
|
// key: file name, value; name
|
||||||
$test_files = [
|
$test_files = [
|
||||||
'class_test.db.php' => 'Class Test: DB',
|
'class_test.db.php' => 'Class Test: DB',
|
||||||
'class_test.db.types.php' => 'Class Test: DB COLUMN TYPES',
|
'class_test.db.types.php' => 'Class Test: DB column type convert',
|
||||||
'class_test.db.single.php' => 'Class Test: DB SINGLE',
|
'class_test.db.query-placeholder.php' => 'Class Test: DB query placeholder convert',
|
||||||
'class_test.db.dbReturn.php' => 'Class Test: DB dbReturn',
|
'class_test.db.dbReturn.php' => 'Class Test: DB dbReturn',
|
||||||
|
'class_test.db.single.php' => 'Class Test: DB single query tests',
|
||||||
'class_test.convert.colors.php' => 'Class Test: CONVERT COLORS',
|
'class_test.convert.colors.php' => 'Class Test: CONVERT COLORS',
|
||||||
'class_test.check.colors.php' => 'Class Test: CHECK COLORS',
|
'class_test.check.colors.php' => 'Class Test: CHECK COLORS',
|
||||||
'class_test.mime.php' => 'Class Test: MIME',
|
'class_test.mime.php' => 'Class Test: MIME',
|
||||||
@@ -177,7 +178,7 @@ $log->debug('SOME MARK', 'Some error output');
|
|||||||
print "EDIT ACCESS ID: " . $backend->edit_access_id . "<br>";
|
print "EDIT ACCESS ID: " . $backend->edit_access_id . "<br>";
|
||||||
if (is_object($login)) {
|
if (is_object($login)) {
|
||||||
// print "ACL: <br>".$backend->print_ar($login->loginGetAcl())."<br>";
|
// print "ACL: <br>".$backend->print_ar($login->loginGetAcl())."<br>";
|
||||||
$log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl()));
|
// $log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl()));
|
||||||
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
||||||
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
|
||||||
// $result = array_flip(
|
// $result = array_flip(
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ $phpv_class = 'CoreLibs\Check\PhpVersion';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: PHP VERSION';
|
$PAGE_NAME = 'TEST CLASS: PHP VERSION';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $array_class = 'CoreLibs\Create\RandomKey';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: RANDOM KEY';
|
$PAGE_NAME = 'TEST CLASS: RANDOM KEY';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ $ref_class = 'CoreLibs\Get\ReadEnvFile';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: READ ENV FILE';
|
$PAGE_NAME = 'TEST CLASS: READ ENV FILE';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: RUNNING TIME';
|
$PAGE_NAME = 'TEST CLASS: RUNNING TIME';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ $session = new Session();
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: SESSION';
|
$PAGE_NAME = 'TEST CLASS: SESSION';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ $session = new Session();
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: SESSION (READ)';
|
$PAGE_NAME = 'TEST CLASS: SESSION (READ)';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ $adm->DATA['adm_set'] = 'SET from admin class';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: SMARTY';
|
$PAGE_NAME = 'TEST CLASS: SMARTY';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -97,7 +97,7 @@ $smarty->DATA['drop_down_test'] = [
|
|||||||
'foobar' => 'Foo Bar',
|
'foobar' => 'Foo Bar',
|
||||||
];
|
];
|
||||||
$smarty->DATA['drop_down_test_selected'] = 'bar';
|
$smarty->DATA['drop_down_test_selected'] = 'bar';
|
||||||
$smarty->DATA['drop_down_test_nested'] = [
|
$smarty->DATA['drop_down_test_nested'] = [
|
||||||
'' => '選択してください',
|
'' => '選択してください',
|
||||||
'4/25(木)' => [
|
'4/25(木)' => [
|
||||||
'4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',
|
'4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ $byte_class = 'CoreLibs\Convert\Strings';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: STRINGS CONVERT';
|
$PAGE_NAME = 'TEST CLASS: STRINGS CONVERT';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: SYSTEM';
|
$PAGE_NAME = 'TEST CLASS: SYSTEM';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
@@ -41,7 +41,7 @@ print "GETPAGENAME(0): " . System::getPageName() . "<br>";
|
|||||||
print "GETPAGENAME(1): " . System::getPageName(System::NO_EXTENSION) . "<br>";
|
print "GETPAGENAME(1): " . System::getPageName(System::NO_EXTENSION) . "<br>";
|
||||||
print "GETPAGENAME(2): " . System::getPageName(System::FULL_PATH) . "<br>";
|
print "GETPAGENAME(2): " . System::getPageName(System::FULL_PATH) . "<br>";
|
||||||
print "System::getPageNameArray():<br>";
|
print "System::getPageNameArray():<br>";
|
||||||
print "GETPAGENAMEARRAY: " . \CoreLibs\Debug\Support::printAr(System::getPageNameArray()) . "<br>";
|
print "GETPAGENAMEARRAY: " . DgS::printAr(System::getPageNameArray()) . "<br>";
|
||||||
// seting errro codes file upload
|
// seting errro codes file upload
|
||||||
print "System::fileUploadErrorMessage():<br>";
|
print "System::fileUploadErrorMessage():<br>";
|
||||||
print "FILEUPLOADERRORMESSAGE(): " . System::fileUploadErrorMessage(-1) . "<br>";
|
print "FILEUPLOADERRORMESSAGE(): " . System::fileUploadErrorMessage(-1) . "<br>";
|
||||||
@@ -51,4 +51,6 @@ print "FILEUPLOADERRORMESSAGE(UPLOAD_ERR_CANT_WRITE): "
|
|||||||
print "System::checkCLI():<br>";
|
print "System::checkCLI():<br>";
|
||||||
print "Are we in an CLI: " . (System::checkCLI() ? 'Yes' : 'No') . "<br>";
|
print "Are we in an CLI: " . (System::checkCLI() ? 'Yes' : 'No') . "<br>";
|
||||||
|
|
||||||
|
print "Get Addresses: " . DgS::printAr(System::getIpAddresses()) . "<br>";
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
@@ -28,7 +28,7 @@ $token_class = 'CoreLibs\Output\Form\Token';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: FORM TOKEN';
|
$PAGE_NAME = 'TEST CLASS: FORM TOKEN';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $uids_class = 'CoreLibs\Create\Uids';
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: UIDS';
|
$PAGE_NAME = 'TEST CLASS: UIDS';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
|
|||||||
|
|
||||||
$PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE';
|
$PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE';
|
||||||
print "<!DOCTYPE html>";
|
print "<!DOCTYPE html>";
|
||||||
print "<html><head><title>" . $PAGE_NAME . "</title><head>";
|
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
|
||||||
print "<body>";
|
print "<body>";
|
||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|||||||
@@ -3,4 +3,3 @@
|
|||||||
// empty file for add and remove test
|
// empty file for add and remove test
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../layout/admin/
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 992 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user