function ModernizrUnitTestCase::testModernizrInfo in Modernizr 8
Same name and namespace in other branches
- 7.3 tests/modernizr.test \ModernizrUnitTestCase::testModernizrInfo()
Tests that modernizr's own implementation of hook_modernizr_info works.
File
- tests/
modernizr.test, line 28 - Tests for Modernizr module.
Class
- ModernizrUnitTestCase
- Tests basic Modernizr API functions.
Code
function testModernizrInfo() {
$tests = modernizr_api_list();
// cssclasses in array and provided by modernizr
$cssclasses = array_key_exists('cssclasses', $tests);
if ($cssclasses) {
// Flip source array for easier truth values.
$module_flip = array_flip($tests['cssclasses']['source']);
$cssclasses = array_key_exists('modernizr', $module_flip);
}
// printshiv in array and provided by modernizr
$printshiv = array_key_exists('printshiv', $tests);
if ($printshiv) {
// Flip source array for easier truth values.
$module_flip = array_flip($tests['printshiv']['source']);
$printshiv = array_key_exists('modernizr', $module_flip);
}
// load in array and provided by modernizr
$load = array_key_exists('load', $tests);
if ($load) {
// Flip source array for easier truth values.
$module_flip = array_flip($tests['load']['source']);
$load = array_key_exists('modernizr', $module_flip);
}
$this
->assertTrue($cssclasses, "Modernizr's implementation of hook_modernizr_info is correctly inserting cssclasses tests into the api assembled test list.");
$this
->assertTrue($printshiv, "Modernizr's implementation of hook_modernizr_info is correctly inserting printshiv tests into the api assembled test list.");
$this
->assertTrue($load, "Modernizr's implementation of hook_modernizr_info is correctly inserting load tests into the api assembled test list.");
}