public function testRequirementsCombine() { $testBackend = new Requirements_Backend(); $testBackend->setSuffixRequirements(false); //$combinedTestFilePath = BASE_PATH . '/' . $testBackend->getCombinedFilesFolder() . '/testRequirementsCombine.js'; $jsFile = FRAMEWORK_DIR . '/tests/view/themes/javascript/bad.js'; $jsFileContents = file_get_contents(BASE_PATH . '/' . $jsFile); $testBackend->combineFiles('testRequirementsCombine.js', array($jsFile)); // first make sure that our test js file causes an exception to be thrown try { require_once 'thirdparty/jsmin/jsmin.php'; $content = JSMin::minify($content); $this->fail('JSMin did not throw exception on minify bad file: '); } catch (Exception $e) { // exception thrown... good } // secondly, make sure that requirements is generated, even though minification failed $testBackend->processCombinedFiles(); $js = $testBackend->getJavascript(); $combinedTestFilePath = BASE_PATH . reset($js); $this->assertContains('testRequirementsCombine.js', $combinedTestFilePath); // and make sure the combined content matches the input content, i.e. no loss of functionality if (!file_exists($combinedTestFilePath)) { $this->fail('No combined file was created at expected path: ' . $combinedTestFilePath); } $combinedTestFileContents = file_get_contents($combinedTestFilePath); $this->assertContains($jsFileContents, $combinedTestFileContents); }