mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 09:53:15 +00:00
36 lines
948 B
PHP
36 lines
948 B
PHP
<?php
|
|
|
|
namespace Alchemy\Tests\Phrasea\Twig;
|
|
|
|
use Alchemy\Phrasea\Twig\BytesConverter;
|
|
|
|
/**
|
|
* @group functional
|
|
* @group legacy
|
|
*/
|
|
class BytesConverterTest extends \PhraseanetTestCase
|
|
{
|
|
/**
|
|
* @dataProvider convertDataProvider
|
|
*/
|
|
public function testConvert($suffix, $bytes, $expected)
|
|
{
|
|
$converter = new BytesConverter();
|
|
$this->assertEquals($converter->bytes2Filter($suffix, $bytes), $expected);
|
|
}
|
|
|
|
public function convertDataProvider()
|
|
{
|
|
return [
|
|
['', 123456789012345, '112.28 TB'],
|
|
['Auto', 123456789012345, '112.28 TB'],
|
|
['Human', 123456789012345, '112.28 TB'],
|
|
['KB', 123456789012345, '120563270519.87 KB'],
|
|
['MB', 123456789012345, '117737568.87 MB'],
|
|
['GB', 123456789012345, '114978.09 GB'],
|
|
['TB', 123456789012345, '112.28 TB'],
|
|
['PB', 123456789012345, '0.11 PB'],
|
|
];
|
|
}
|
|
}
|