diff --git a/tests/Transformer/FormatTransformerTest.php b/tests/Transformer/FormatTransformerTest.php new file mode 100644 index 0000000..3548355 --- /dev/null +++ b/tests/Transformer/FormatTransformerTest.php @@ -0,0 +1,28 @@ +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)); + } +}