Exemple #1
0
 public function testGetContent_Full()
 {
     $context = $this->getMock('\\r8\\Page\\Context');
     $wrapped = $this->getMock('\\r8\\iface\\Page');
     $wrapped->expects($this->once())->method("getContent")->with($this->equalTo($context))->will($this->returnValue(new \r8\Template\Raw("Page Content")));
     $head = new \r8\HTML\Head();
     $head->setDocType(\r8\HTML\DocType::HTML5());
     $head->setTitle("Test");
     $head->addCSS(new \r8\HTML\CSS("test.css"));
     $head->addCSS(new \r8\HTML\CSS("example.css"));
     $head->addJavascript(new \r8\HTML\Javascript("test.js"));
     $head->addJavascript(new \r8\HTML\Javascript("example.js"));
     $head->addMetaTag(new \r8\HTML\MetaTag("name", "content"));
     $head->addMetaTag(new \r8\HTML\MetaTag("robots", "index, follow"));
     $page = new \r8\Page\Head($head, $wrapped);
     $result = $page->getContent($context);
     $this->assertThat($result, $this->isInstanceOf('\\r8\\iface\\Template'));
     $this->assertSame('<!DOCTYPE html>' . "\n" . '<html>' . "\n" . '<head>' . '<title>Test</title>' . "\n" . '<meta name="name" content="content" />' . "\n" . '<meta name="robots" content="index, follow" />' . "\n" . '<link rel="stylesheet" href="test.css" type="text/css" media="all" />' . "\n" . '<link rel="stylesheet" href="example.css" type="text/css" media="all" />' . "\n" . '<script type="text/javascript" src="test.js"></script>' . "\n" . '<script type="text/javascript" src="example.js"></script>' . '</head>' . "\n" . '<body>' . "\n" . 'Page Content' . "\n" . '</body>' . "\n" . '</html>', $result->render());
 }
Exemple #2
0
 /**
  * Constructor...
  */
 public function __construct()
 {
     $this->docType = \r8\HTML\DocType::NONE();
 }
Exemple #3
0
 public function testGetTag_Full()
 {
     $head = new \r8\HTML\Head();
     $head->setDocType(\r8\HTML\DocType::HTML5());
     $head->setTitle("Test");
     $head->addCSS(new \r8\HTML\CSS("test.css"));
     $head->addCSS(new \r8\HTML\CSS("example.css"));
     $head->addJavascript(new \r8\HTML\Javascript("test.js"));
     $head->addJavascript(new \r8\HTML\Javascript("example.js"));
     $head->addMetaTag(new \r8\HTML\MetaTag("name", "content"));
     $head->addMetaTag(new \r8\HTML\MetaTag("robots", "index, follow"));
     $tag = $head->getTag();
     $this->assertThat($tag, $this->isInstanceOf('\\r8\\HTML\\Tag'));
     $this->assertSame('head', $tag->getTag());
     $this->assertSame('<title>Test</title>' . "\n" . '<meta name="name" content="content" />' . "\n" . '<meta name="robots" content="index, follow" />' . "\n" . '<link rel="stylesheet" href="test.css" type="text/css" media="all" />' . "\n" . '<link rel="stylesheet" href="example.css" type="text/css" media="all" />' . "\n" . '<script type="text/javascript" src="test.js"></script>' . "\n" . '<script type="text/javascript" src="example.js"></script>', $tag->getContent());
 }