public function combine_files($combinedFileName, $files, $media = null)
 {
     foreach ($files as $i => $fileName) {
         $files[$i] = $this->collectFile($fileName);
     }
     return parent::combine_files($combinedFileName, $files, $media);
 }
 public function testProcessOnlyIncludesRequirementsOnce()
 {
     $template = new SSViewer(array('SSViewerTestProcess'));
     $basePath = dirname($this->getCurrentRelativePath()) . '/forms';
     $backend = new Requirements_Backend();
     $backend->set_combined_files_enabled(false);
     $backend->combine_files('RequirementsTest_ab.css', array($basePath . '/RequirementsTest_a.css', $basePath . '/RequirementsTest_b.css'));
     Requirements::set_backend($backend);
     $this->assertEquals(1, substr_count($template->process(array()), "a.css"));
     $this->assertEquals(1, substr_count($template->process(array()), "b.css"));
     // if we disable the requirements then we should get nothing
     $template->includeRequirements(false);
     $this->assertEquals(0, substr_count($template->process(array()), "a.css"));
     $this->assertEquals(0, substr_count($template->process(array()), "b.css"));
 }
 public function testCombinedCss()
 {
     $basePath = $this->getCurrentRelativePath();
     $backend = new Requirements_Backend();
     $backend->set_combined_files_enabled(true);
     $backend->combine_files('print.css', array($basePath . '/RequirementsTest_print_a.css', $basePath . '/RequirementsTest_print_b.css'), 'print');
     $html = $backend->includeInHTML(false, self::$html_template);
     $this->assertTrue((bool) preg_match('/href=".*\\/print\\.css/', $html), 'Print stylesheets have been combined.');
     $this->assertTrue((bool) preg_match('/media="print/', $html), 'Combined print stylesheet retains the media parameter');
 }