CRM-21591 Add Test of formatUnitSize Function
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 22 Dec 2017 05:26:17 +0000 (16:26 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 22 Dec 2017 05:41:23 +0000 (16:41 +1100)
tests/phpunit/CRM/Utils/NumberTest.php

index 7a91bbd3d53bd01d9164710088ee01a910ba221d..9804bce4efc8b2038bf6d0b74b8c705d5029f3c2 100644 (file)
@@ -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));
+  }
+
 }