public function testExternalUrls()
 {
     $backend = new Requirements_Backend();
     $backend->setCombinedFilesEnabled(true);
     $backend->javascript('http://www.mydomain.com/test.js');
     $backend->javascript('https://www.mysecuredomain.com/test.js');
     $backend->javascript('//scheme-relative.example.com/test.js');
     $backend->css('http://www.mydomain.com/test.css');
     $backend->css('https://www.mysecuredomain.com/test.css');
     $backend->css('//scheme-relative.example.com/test.css');
     $html = $backend->includeInHTML(false, self::$html_template);
     $this->assertTrue(strpos($html, 'http://www.mydomain.com/test.js') !== false, 'Load external javascript URL');
     $this->assertTrue(strpos($html, 'https://www.mysecuredomain.com/test.js') !== false, 'Load external secure javascript URL');
     $this->assertTrue(strpos($html, '//scheme-relative.example.com/test.js') !== false, 'Load external scheme-relative javascript URL');
     $this->assertTrue(strpos($html, 'http://www.mydomain.com/test.css') !== false, 'Load external CSS URL');
     $this->assertTrue(strpos($html, 'https://www.mysecuredomain.com/test.css') !== false, 'Load external secure CSS URL');
     $this->assertTrue(strpos($html, '//scheme-relative.example.com/test.css') !== false, 'Load scheme-relative CSS URL');
 }
 public function testProcessOnlyIncludesRequirementsOnce()
 {
     $template = new SSViewer(array('SSViewerTestProcess'));
     $basePath = dirname($this->getCurrentRelativePath()) . '/forms';
     $backend = new Requirements_Backend();
     $backend->setCombinedFilesEnabled(false);
     $backend->combineFiles('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"));
 }