public function testRenderCrossSite()
 {
     $smarty = new Smarty();
     $render = new CM_Frontend_Render();
     $siteOther = $this->getMockSite('CM_Site_Abstract', null, ['urlCdn' => 'http://cdn.other.com']);
     $renderOther = new CM_Frontend_Render(new CM_Frontend_Environment($siteOther));
     $template = $smarty->createTemplate('string:');
     $template->assignGlobal('render', $render);
     $this->assertSame($renderOther->getUrlResource('layout', 'foo'), smarty_function_resourceUrl(array('path' => 'foo', 'type' => 'layout', 'site' => $siteOther), $template));
     $this->assertSame($renderOther->getUrlStatic('foo'), smarty_function_resourceUrl(array('path' => 'foo', 'type' => 'static', 'site' => $siteOther), $template));
 }
Beispiel #2
0
    public function testUrlFont()
    {
        $render = new CM_Frontend_Render();
        $css = new CM_Asset_Css($render, "body { src: url(urlFont('file.eot')); }");
        $url = $render->getUrlStatic('/font/file.eot');
        $expected = <<<EOD
body {
  src: url('{$url}');
}
EOD;
        $this->assertEquals($expected, $css->get());
    }
Beispiel #3
0
 public function testGetUrlStaticDifferentSite()
 {
     $render = new CM_Frontend_Render();
     $site = $this->getMockSite('CM_Site_Abstract', null, ['urlCdn' => 'http://cdn.other.com']);
     $deployVersion = CM_App::getInstance()->getDeployVersion();
     $this->assertSame('http://cdn.other.com/static/foo.jpg?' . $deployVersion, $render->getUrlStatic('/foo.jpg', $site));
 }
Beispiel #4
0
 public function testGetUrlStaticWithoutCdn()
 {
     $site = $this->getMockBuilder('CM_Site_Abstract')->setMethods(array('getUrlCdn'))->getMockForAbstractClass();
     $site->expects($this->any())->method('getUrlCdn')->will($this->returnValue(null));
     /** @var CM_Site_Abstract $site */
     $render = new CM_Frontend_Render(new CM_Frontend_Environment($site));
     $deployVersion = CM_App::getInstance()->getDeployVersion();
     $this->assertSame('http://www.default.dev/static/foo.jpg?' . $deployVersion, $render->getUrlStatic('/foo.jpg'));
 }