for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kint\Test;
use Kint\Utils;
use PHPUnit_Framework_TestCase;
class UtilsTest extends PHPUnit_Framework_TestCase
{
public function humanReadableBytesProvider()
return array(
'1 byte' => array(
1,
array(
'value' => 1.0,
'unit' => 'B',
),
'1023 bytes' => array(
1023,
'value' => 1023.0,
'1024 bytes' => array(
1024,
'unit' => 'KB',
'1 meg' => array(
pow(2, 20),
'unit' => 'MB',
'1 gig' => array(
pow(2, 30),
'unit' => 'GB',
'1 tig' => array(
pow(2, 40),
'unit' => 'TB',
'>1 tig' => array(
pow(2, 50),
'value' => 1024.0,
'halfway' => array(
15000,
'value' => 15000 / 1024,
);
}
/**
* @covers \Kint\Utils::getHumanReadableBytes
* @dataProvider humanReadableBytesProvider
*/
public function testGetHumanReadableBytes($input, $expect)
$this->assertSame($expect, Utils::getHumanReadableBytes($input));