Tests CSS ordering.
function testRenderOrder() {
// Load a module CSS file.
drupal_add_css(drupal_get_path('module', 'simpletest') . '/css/simpletest.module.css');
// Load a few system CSS files in a custom, early-loading aggregate group.
$test_aggregate_group = -100;
$system_path = drupal_get_path('module', 'system');
drupal_add_css($system_path . '/css/system.module.css', array(
'group' => $test_aggregate_group,
'weight' => -10,
));
drupal_add_css($system_path . '/css/system.theme.css', array(
'group' => $test_aggregate_group,
));
$expected = array(
$system_path . '/css/system.module.css',
$system_path . '/css/system.theme.css',
drupal_get_path('module', 'simpletest') . '/css/simpletest.module.css',
);
$styles = drupal_get_css();
// Stylesheet URL may be the href of a LINK tag or in an @import statement
// of a STYLE tag.
if (preg_match_all('/(href="|url\\(")' . preg_quote($GLOBALS['base_url'] . '/', '/') . '([^?]+)\\?/', $styles, $matches)) {
$result = $matches[2];
}
else {
$result = array();
}
$this
->assertIdentical($result, $expected, 'The CSS files are in the expected order.');
}