public function testFavicon() { $favicon = new FaviconElement(); $favicon->setBasePath('/path/to/favicon/'); $favicon->setTileColor('#000000'); $favicon->setFaviconTemplate('{{basepath}} {{tileColor}} {{basepath}} {{tileColor}}'); $this->assertEquals($favicon->render(), '/path/to/favicon/ #000000 /path/to/favicon/ #000000'); $favicon->enable(false); $this->assertEquals($favicon->render(), ''); $favicon->enable(true); $favicon->setFaviconTemplate('<link rel="apple-touch-icon" sizes="57x57" href="{{basepath}}/apple-touch-icon-57x57.png"><meta name="msapplication-TileColor" content="{{tileColor}}">'); $this->assertEquals($favicon->render(), '<link rel="apple-touch-icon" sizes="57x57" href="/path/to/favicon//apple-touch-icon-57x57.png"><meta name="msapplication-TileColor" content="#000000">'); }
public function __construct() { $this->doctype = new TxtElement('<!DOCTYPE html>'); $this->html = new HtmlElement('html'); $this->head = new HtmlElement('head'); $this->title = new HtmlElement('title'); $this->title->insertTo($this->head); $this->charset = new HtmlElement('meta'); $this->charset->attr('charset', 'utf-8')->insertTo($this->head); $this->viewport = new HtmlElement('meta'); $this->viewport->attr('name', 'viewport')->attr('content', 'width=device-width, initial-scale=1.0')->insertTo($this->head); $this->xua_compatible = new HtmlElement('meta'); $this->xua_compatible->attr('http-equiv', 'X-UA-Compatible')->attr('content', 'IE=Edge,chrome=1')->insertTo($this->head); $this->favicon = new FaviconElement(); $this->favicon->enable(false); $this->script = new TxtElement(); $this->author = new HtmlElement('meta'); $this->authorUrl = new HtmlElement('link'); $this->description = new HtmlElement('meta'); $this->keywords = new HtmlElement('meta'); $this->javaScript = new JavaScriptResourceManager(new ResourceGroups()); $this->styleSheet = new StyleSheetResourceManager(new ResourceGroups()); $this->setScriptOutput(function (JavaScriptResourceManager $manager) { return $manager->render('html'); }); }