public function testAddTest() { $test = "window.JSON"; $yep = array('yep.js'); $nope = array('nope.js'); $load = array('always-load.js'); $callback = 'function() { callback(); }'; $complete = 'function() { complete(); }'; Yepnope::add_test($test, $yep, $nope, $load, $callback, $complete); Yepnope::eval_yepnope(); $scripts = Requirements::get_custom_scripts(); $expects = <<<JS yepnope([ { "test": window.JSON, "yep": [ "yep.js" ], "nope": [ "nope.js" ], "load": [ "always-load.js" ], "callback": function() { callback(); }, "complete": function() { complete(); } } ]); JS; $this->assertContains($expects, $scripts); $test2 = "Modernizr.geolocation"; $yep2 = array('hasGeo.js'); $nope2 = array('geoPolyfill.js'); $load2 = array('geo-app.js'); $callback2 = 'function() { geoLoaded(); }'; $complete2 = 'function() { geoComplete(); }'; Yepnope::add_test($test2, $yep2, $nope2, $load2, $callback2, $complete2); Yepnope::eval_yepnope(); $scripts = Requirements::get_custom_scripts(); $expects = <<<JS yepnope([ { "test": window.JSON, "yep": [ "yep.js" ], "nope": [ "nope.js" ], "load": [ "always-load.js" ], "callback": function() { callback(); }, "complete": function() { complete(); } }, { "test": Modernizr.geolocation, "yep": [ "hasGeo.js" ], "nope": [ "geoPolyfill.js" ], "load": [ "geo-app.js" ], "callback": function() { geoLoaded(); }, "complete": function() { geoComplete(); } } ]); JS; $this->assertContains($expects, $scripts); }