public function MagicJSTestCase::testMagicJSExcludes in Magic 7.2
Test magic_assets_exclude().
Testing to see if our regex sends back the appropriate responses.
File
- ./
magic.test, line 253 - A few tests to ensure the magic module is doing what it should be.
Class
- MagicJSTestCase
- An even quicker test to ensure that we have the right CSS gets returned when we run our regex to selectively remove files.
Code
public function testMagicJSExcludes() {
module_load_include('inc', 'magic', 'includes/magic.assets');
// A set of trials for our CSS testing.
$tests = array(
array(
'removal' => array(
'overlay/*.js',
),
'expected' => array(
'ctools',
'theme',
'external',
'inline',
),
'message' => 'Ensuring the js removal also works',
),
array(
'removal' => array(
':all',
'~:current-theme',
),
'expected' => array(
'theme',
'inline',
),
'message' => 'Ensure the tokens work with JS',
),
);
foreach ($tests as $test) {
$js = $this
->the_js_files();
$expected = $this
->the_js_files($test['expected']);
$steps = magic_assets_regex_steps($test['removal']);
magic_assets_exclude($js, $steps);
// We run this so that the array keys are the same.
$js = array_values($js);
$this
->assertEqual($expected, $js, $test['message']);
}
}