}
}
+ /**
+ * 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
$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']
+ )
+ ),
);
}
}
'lists' => array(
'scripts',
'debugScripts',
- 'loaderScripts',
'styles',
),
( $file instanceof ResourceLoaderFilePath ? $file->getPath() : $file ),
);
}
+
+ // To populate missingLocalFileRefs. Not sure how sane this is inside this test...
+ $module->readStyleFiles(
+ $module->getStyleFiles( $data['context'] ),
+ $module->getFlip( $data['context'] ),
+ $data['context']
+ );
+
+ $property = $reflectedModule->getProperty( 'missingLocalFileRefs' );
+ $property->setAccessible( true );
+ $missingLocalFileRefs = $property->getValue( $module );
+
+ foreach ( $missingLocalFileRefs as $file ) {
+ $cases[] = array(
+ $file,
+ $moduleName,
+ $file,
+ );
+ }
}
return $cases;