Revert "Revert "API: Add a unit test to check all modules' i18n""
[lhc/web/wiklou.git] / tests / phpunit / structure / ResourcesTest.php
index 69f4525..3282665 100644 (file)
@@ -118,6 +118,22 @@ class ResourcesTest extends MediaWikiTestCase {
                }
        }
 
+       /**
+        * CSSMin::getAllLocalFileReferences should ignore url(...) expressions
+        * that have been commented out.
+        */
+       public function testCommentedLocalFileReferences() {
+               $basepath = __DIR__ . '/../data/css/';
+               $css = file_get_contents( $basepath . 'comments.css' );
+               $files = CSSMin::getAllLocalFileReferences( $css, $basepath );
+               $expected = array( $basepath . 'not-commented.gif' );
+               $this->assertArrayEquals(
+                       $expected,
+                       $files,
+                       'Url(...) expression in comment should be omitted.'
+               );
+       }
+
        /**
         * Get all registered modules from ResouceLoader.
         * @return array
@@ -182,7 +198,14 @@ class ResourcesTest extends MediaWikiTestCase {
                                                        $media,
                                                        $file,
                                                        // XXX: Wrapped in an object to keep it out of PHPUnit output
-                                                       (object)array( 'cssText' => $readStyleFile->invoke( $module, $file, $flip ) ),
+                                                       (object)array(
+                                                               'cssText' => $readStyleFile->invoke(
+                                                                       $module,
+                                                                       $file,
+                                                                       $flip,
+                                                                       $data['context']
+                                                               )
+                                                       ),
                                                );
                                        }
                                }
@@ -209,7 +232,6 @@ class ResourcesTest extends MediaWikiTestCase {
                        'lists' => array(
                                'scripts',
                                'debugScripts',
-                               'loaderScripts',
                                'styles',
                        ),