From ff00c761dcc473082344187f7316de041e37ed4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCbner?= Date: Fri, 5 May 2017 21:06:06 +0200 Subject: [PATCH] Add FormatTransformer tests --- tests/Transformer/FormatTransformerTest.php | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/Transformer/FormatTransformerTest.php 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)); + } +}