/** * Generate a compiled asset, with all the configured filters applied. * * @param string $target The name of the build target to generate. * @return The processed result of $target and it dependencies. * @throws RuntimeException */ public function generate($build) { $this->_fileList = array(); $output = ''; foreach ($this->_getFilesList($build) as $file) { $content = $this->_readFile($file); $content = $this->_FilterCollection->input($file, $content); $output .= $content . "\n"; } if (Configure::read('debug') < 2 || php_sapi_name() === 'cli') { $output = $this->_FilterCollection->output($build, $output); } return trim($output); }
public function testInputOrder() { $filters = array('TestFilterOne', 'TestFilterTwo'); $Filters = new AssetFilterCollection($filters, array(), array()); $result = $Filters->input('test.js', 'test content'); $expected = <<<TEXT FilterTwo::input() FilterOne::input() test content TEXT; $this->assertTextEquals($expected, $result); }