Initial tests for wfShorthandToInteger(). Definitely needs more
authorChad Horohoe <demon@users.mediawiki.org>
Sun, 16 Oct 2011 18:35:32 +0000 (18:35 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sun, 16 Oct 2011 18:35:32 +0000 (18:35 +0000)
tests/phpunit/includes/GlobalFunctions/wfShorthandToInteger.php [new file with mode: 0644]

diff --git a/tests/phpunit/includes/GlobalFunctions/wfShorthandToInteger.php b/tests/phpunit/includes/GlobalFunctions/wfShorthandToInteger.php
new file mode 100644 (file)
index 0000000..9b48e9b
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+class wfShorthandToIntegerTest extends MediaWikiTestCase {
+       /**
+        * @dataProvider provideABunchOfShorthands
+        */
+       function testWfShorthandToInteger( $input, $output, $description ) {
+               $this->assertEquals(
+                       wfShorthandToInteger( $input ),
+                       $output,
+                       $description
+               );
+       }
+
+       function provideABunchOfShorthands() {
+               return array(
+                       array( '', -1, 'Empty string' ),
+                       array( '     ', -1, 'String of spaces' ),
+                       array( '1G', 1024 * 1024 * 1024, 'One gig uppercased' ),
+                       array( '1g', 1024 * 1024 * 1024, 'One gig lowercased' ),
+               );
+       }
+       
+}