From 20a30849a4b4aa4f917a9a81663f9e37f4f3e037 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 22 Dec 2017 16:26:17 +1100 Subject: [PATCH] CRM-21591 Add Test of formatUnitSize Function --- tests/phpunit/CRM/Utils/NumberTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/phpunit/CRM/Utils/NumberTest.php b/tests/phpunit/CRM/Utils/NumberTest.php index 7a91bbd3d5..9804bce4ef 100644 --- a/tests/phpunit/CRM/Utils/NumberTest.php +++ b/tests/phpunit/CRM/Utils/NumberTest.php @@ -67,4 +67,20 @@ class CRM_Utils_NumberTest extends CiviUnitTestCase { ); } + public function sizeCases() { + $cases = []; + $cases[] = ['20M', '20971520']; + $cases[] = ['40G', '42949672960']; + return $cases; + } + + /** + * @param $size + * @param $expectedValue + * @dataProvider sizeCases + */ + public function testFormatUnitSize($size, $expectedValue) { + $this->assertEquals($expectedValue, CRM_Utils_Number::formatUnitSize($size)); + } + } -- 2.25.1