assertEquals(
+ $request_expected,
+ json_decode($response['content'], true),
+ 'multi call: delete content not matching'
+ );
}
// MARK: auth header set via config
diff --git a/www/admin/class_test.byte.php b/www/admin/class_test.byte.php
index cc17ce2f..81577703 100644
--- a/www/admin/class_test.byte.php
+++ b/www/admin/class_test.byte.php
@@ -74,9 +74,21 @@ foreach ($bytes as $byte) {
print '';
print "(" . number_format($byte) . "/" . $byte . ") bytes :";
$_bytes = Byte::humanReadableByteFormat($byte);
- print '
' . $_bytes;
- print '
';
- print Byte::stringByteFormat($_bytes);
+ print '
';
+ print '' . $_bytes . '
';
+ print '';
+ try {
+ print Byte::stringByteFormat($_bytes);
+ } catch (\LengthException $e) {
+ print "LengthException 1: " . $e->getMessage();
+ try {
+ print "
S: " . Byte::stringByteFormat($_bytes, Byte::RETURN_AS_STRING);
+ } catch (\LengthException $e) {
+ print "LengthException 2: " . $e->getMessage();
+ } catch (\RuntimeException $e) {
+ print "RuntimeException 1: " . $e->getMessage();
+ }
+ }
print "
";
//
print "";
@@ -87,13 +99,85 @@ foreach ($bytes as $byte) {
print "bytes [si]:";
$_bytes = Byte::humanReadableByteFormat($byte, Byte::BYTE_FORMAT_SI);
print '' . $_bytes;
- print '
';
- print Byte::stringByteFormat($_bytes);
+ print '
';
+ try {
+ print Byte::stringByteFormat($_bytes);
+ } catch (\LengthException $e) {
+ print "LengthException A: " . $e->getMessage();
+ try {
+ print "
Ssi: " . Byte::stringByteFormat($_bytes, Byte::RETURN_AS_STRING | Byte::BYTE_FORMAT_SI);
+ } catch (\LengthException $e) {
+ print "LengthException B: " . $e->getMessage();
+ } catch (\RuntimeException $e) {
+ print "RuntimeException A: " . $e->getMessage();
+ }
+ }
print "
";
//
print "";
}
+$string_bytes = [
+ '-117.42 MB',
+ '242.98 MB',
+ '254.78 MiB',
+ '1 EiB',
+ '8 EB',
+ '867.36EB',
+ '1000EB',
+ '10000EB',
+];
+print "BYTE STRING TO BYTES TESTS
";
+foreach ($string_bytes as $string) {
+ print '';
+ //
+ print '
';
+ print "string byte ($string) to bytes :";
+ try {
+ $_bytes = Byte::stringByteFormat($string);
+ } catch (\LengthException $e) {
+ print "
LengthException A: " . $e->getMessage();
+ $_bytes = 0;
+ }
+ try {
+ $_bytes_string = Byte::stringByteFormat($string, Byte::RETURN_AS_STRING);
+ } catch (\LengthException $e) {
+ print "
LengthException B: " . $e->getMessage();
+ $_bytes_string = '';
+ } catch (\RuntimeException $e) {
+ print "
RuntimeException: " . $e->getMessage();
+ $_bytes_string = '';
+ }
+ try {
+ $_bytes_si = Byte::stringByteFormat($string, Byte::BYTE_FORMAT_SI);
+ } catch (\LengthException $e) {
+ print "
LengthException A: " . $e->getMessage();
+ $_bytes_si = 0;
+ }
+ try {
+ $_bytes_string_si = Byte::stringByteFormat($string, Byte::RETURN_AS_STRING | Byte::BYTE_FORMAT_SI);
+ } catch (\LengthException $e) {
+ print "
LengthException B: " . $e->getMessage();
+ $_bytes_string_si = '';
+ } catch (\RuntimeException $e) {
+ print "
RuntimeException: " . $e->getMessage();
+ $_bytes_string_si = '';
+ }
+ print '
';
+ print '
'
+ . "F:" . number_format((int)$_bytes)
+ . '
B: ' . $_bytes
+ . '
S: ' . $_bytes_string
+ . "
Fsi:" . number_format((int)$_bytes_si)
+ . '
Bsi: ' . $_bytes_si
+ . '
Ssi: ' . $_bytes_string_si;
+ print '
';
+ print '
';
+ print "B: " . Byte::humanReadableByteFormat($_bytes) . "
";
+ print "Bsi: " . Byte::humanReadableByteFormat($_bytes_si, Byte::BYTE_FORMAT_SI);
+ print "
";
+ print "
";
+}
print "