Add tests for 47e0f0c3 (MessageCache::normalizeKey())
authorBrian Wolff <bawolff+wn@gmail.com>
Sun, 19 Jul 2015 09:02:57 +0000 (03:02 -0600)
committerBrian Wolff <bawolff+wn@gmail.com>
Sun, 19 Jul 2015 09:12:33 +0000 (03:12 -0600)
Change-Id: If8c88383ccfcfcf08d3d85e5648eb338f0d14268

tests/phpunit/includes/cache/MessageCacheTest.php

index 9c59e65..5302b36 100644 (file)
@@ -124,4 +124,26 @@ class MessageCacheTest extends MediaWikiLangTestCase {
                );
        }
 
+       /**
+        * @dataProvider provideNormalizeKey
+        */
+       public function testNormalizeKey( $key, $expected ) {
+               $actual = MessageCache::normalizeKey( $key );
+               $this->assertEquals( $expected, $actual );
+       }
+
+       public function provideNormalizeKey() {
+               return array(
+                       array( 'Foo', 'foo' ),
+                       array( 'foo', 'foo' ),
+                       array( 'fOo', 'fOo' ),
+                       array( 'FOO', 'fOO' ),
+                       array( 'Foo bar', 'foo_bar' ),
+                       array( 'Ćab', 'ćab' ),
+                       array( 'Ćab_e 3', 'ćab_e_3' ),
+                       array( 'ĆAB', 'ćAB' ),
+                       array( 'ćab', 'ćab' ),
+                       array( 'ćaB', 'ćaB' ),
+               );
+       }
 }