Skip to content

Commit

Permalink
Update HTTP tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ve3 committed Dec 8, 2021
1 parent 6db4331 commit 0a2dfa6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/via-http/strftime-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@


if (version_compare(PHP_VERSION, '8.1', '>=')) {
echo '<div style="border-left: 5px solid #f00; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); font-size: 1em; padding: 2px 5px;"><code>strftime()</code> is deprecated since PHP 8.1.</div>' . PHP_EOL;
echo '<div style="border-left: 5px solid #f00; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); font-size: 1em; margin: 0 0 20px; padding: 2px 5px;"><code>strftime()</code> is deprecated since PHP 8.1.</div>' . PHP_EOL;
}
if (!function_exists('strftime')) {
die('<p><code>strftime()</code> function is not exists.<p>');
}

$locale = 'th';
Expand Down
15 changes: 14 additions & 1 deletion tests/via-http/thaistrftime-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@
echo 'Begin test thaistrftime();.'."<br>\n";
echo 'time(); = '.time()."<br>\n";
echo 'Current date/time use date(); = '.date('Y-m-d H:i:s')."<br>\n";
echo 'Current date/time use strftime(); = '.strftime('%#d %A %B %Y')."<br>\n";
if (function_exists('strftime')) {
echo 'Current date/time use strftime(); = ' . @strftime('%#d %A %B %Y')."<br>\n";
if (version_compare(PHP_VERSION, '8.1', '>=')) {
echo '<div style="border-left: 5px solid #f00; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); font-size: 1em; margin: 0 0 20px; padding: 2px 5px;"><code>strftime()</code> is deprecated since PHP 8.1.</div>' . PHP_EOL;
}
} else {
echo 'Function strftime() is not exists.<br>' . "\n";
}
if (class_exists('IntlDateFormatter')) {
$IntlDateFormatter = new \IntlDateFormatter(null, \IntlDateFormatter::FULL, \IntlDateFormatter::FULL);
echo 'Current date/time use IntlDateFormatter(); = ' . $IntlDateFormatter->format(time()) . "<br>\n";
} else {
echo 'Class IntlDateFormatter() is not exits.<br>' . "\n";
}
echo '----------------------------------'."<br>\n";
echo 'Thai date test.'."<br>\n";
echo '12 Months'."<br>\n";
Expand Down

0 comments on commit 0a2dfa6

Please sign in to comment.