public function testCreatingLinkStackViaHeadLinkCreatesAppropriateOutput() { $links = array('link1' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'foo'), 'link2' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'bar'), 'link3' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'baz')); $this->helper->headLink($links['link1'])->headLink($links['link2'], 'PREPEND')->headLink($links['link3']); $string = $this->helper->toString(); $lines = substr_count($string, PHP_EOL); $this->assertEquals(2, $lines); $lines = substr_count($string, '<link '); $this->assertEquals(3, $lines, $string); foreach ($links as $link) { $substr = ' href="' . $link['href'] . '"'; $this->assertContains($substr, $string); $substr = ' rel="' . $link['rel'] . '"'; $this->assertContains($substr, $string); $substr = ' type="' . $link['type'] . '"'; $this->assertContains($substr, $string); } $order = array(); foreach ($this->helper as $key => $value) { if (isset($value->href)) { $order[$key] = $value->href; } } $expected = array('bar', 'foo', 'baz'); $this->assertSame($expected, $order); }