mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-19 13:40:08 -07:00
Add FormatTransformer tests
This commit is contained in:
parent
32bac75cbd
commit
ff00c761dc
28
tests/Transformer/FormatTransformerTest.php
Normal file
28
tests/Transformer/FormatTransformerTest.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\AppBundle\Transformer;
|
||||||
|
|
||||||
|
use AppBundle\Transformer\FormatTransformer;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class FormatTransformerTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var FormatTransformer
|
||||||
|
*/
|
||||||
|
private $transformer;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->transformer = new FormatTransformer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testBytesToSize() {
|
||||||
|
$this->assertEquals('1.5 MB', $this->transformer->bytesToSize(512*1024+1024*1024, 2));
|
||||||
|
$this->assertEquals('512 B', $this->transformer->bytesToSize(512, 2));
|
||||||
|
$this->assertEquals('1 KB', $this->transformer->bytesToSize(1024, 2));
|
||||||
|
$this->assertEquals('1 MB', $this->transformer->bytesToSize(1024*1024, 2));
|
||||||
|
$this->assertEquals('1 GB', $this->transformer->bytesToSize(1024*1024*1024, 2));
|
||||||
|
$this->assertEquals('1 TB', $this->transformer->bytesToSize(1024*1024*1024*1024, 2));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user