19 declare(strict_types=1);
    21 require_once(
"./vendor/composer/vendor/autoload.php");
    43             [28_566_695, 
'28.57 MB'],
    44             [48_521_625, 
'48.52 MB'],
    45             [58_777_412_654, 
'58.78 GB'],
    46             [46_546_544_654_545, 
'46.55 TB'],
    47             [125_862_151_563_255_622, 
'125862.15 TB'],
    56         $datasize = 
new DataSize($bytes, DataSize::Byte);
    58         $this->assertEquals($expected_representation, $datasize->__toString());
    67         $this->assertEquals(
$a / 
$b, $ds->getSize());
    68         $this->assertEquals(
$b, $ds->getUnit());
    69         $this->assertEquals($expected, $ds->__toString());
    70         if ($expected_in_bytes) {
    71             $this->assertEquals($expected_in_bytes, (
int) $ds->inBytes());
    79             $this->assertFalse(
"This should not happen");
    81             $this->assertTrue(
true);
    88             [122, 1000, 
"122 B", 122],
    89             [-122, 1000, 
"-122 B", -122],
    90             [122, 1000000, 
"122 B", 122],
    91             [-122, 1000000, 
"-122 B", -122],
    92             [122, 1000000000, 
"122 B", 122],
    93             [-122, 1000000000, 
"-122 B", -122],
    94             [122, 1000000000000, 
"122 B", null], 
    95             [-122, 1000000000000, 
"-122 B", null], 
    96             [122, 1024, 
"122 B", 122],
    97             [-122, 1024, 
"-122 B", -122],
    98             [122, 1048576, 
"122 B", 122],
    99             [-122, 1048576, 
"-122 B", -122],
   100             [122, 1073741824, 
"122 B", 122],
   101             [-122, 1073741824, 
"-122 B", -122],
   102             [122, 1099511627776, 
"122 B", 122],
   103             [-122, 1099511627776, 
"-122 B", -122],
   104             [10 * DataSize::KiB, DataSize::KiB, 
"10.24 KB", 10 * DataSize::KiB],
 static provideDataSizes()
 
This class provides the data size with additional information to remove the work to calculate the siz...
 
test_normal($a, $b, $expected, $expected_in_bytes)
tDataProvider 
 
Testing the DataSize object. 
 
testDifferentDataSizes(int $bytes, string $expected_representation)
provideDataSizes 
 
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples