urlGenerator = new UrlGenerator(new RouteCollection(), Request::create('/foo', 'GET')); $this->viewFactory = m::mock(Factory::class); $this->htmlBuilder = new HtmlBuilder($this->urlGenerator, $this->viewFactory); } public function tearDown() { m::close(); } public function testDl() { $list = [ 'foo' => 'bar', 'bing' => 'baz', ]; $attributes = ['class' => 'example']; $result = $this->htmlBuilder->dl($list, $attributes); $this->assertEquals('
foo
bar
bing
baz
', $result); } public function testMeta() { $result = $this->htmlBuilder->meta('description', 'Lorem ipsum dolor sit amet.'); $this->assertEquals('' . PHP_EOL, $result); } public function testMetaOpenGraph() { $result = $this->htmlBuilder->meta(null, 'website', ['property' => 'og:type']); $this->assertEquals('' . PHP_EOL, $result); } public function testFavicon() { $this->urlGenerator->forceRootUrl('http://foo.com'); $target = $this->urlGenerator->to('bar.ico'); $result = $this->htmlBuilder->favicon('http://foo.com/bar.ico'); $this->assertEquals('' . PHP_EOL, $result); } public function testComponentRegistration() { $this->htmlBuilder->component('tweet', 'components.tweet', ['handle', 'body', 'date']); $this->assertTrue($this->htmlBuilder->hasComponent('tweet')); } }