public function testNestedCapturingFails() { $this->helper->headStyle()->captureStart(); echo "Captured text"; try { $this->helper->headStyle()->captureStart(); $this->helper->headStyle()->captureEnd(); $this->fail('Nested capturing should fail'); } catch (Zend_View_Exception $e) { $this->helper->headStyle()->captureEnd(); $this->assertContains('Cannot nest', $e->getMessage()); } }
public function testToStyleGeneratesValidHtml() { $style1 = 'a {}'; $style2 = 'body {}' . PHP_EOL . 'h1 {}'; $style3 = 'div {}' . PHP_EOL . 'li {}'; $this->helper->headStyle($style1, 'SET') ->headStyle($style2, 'PREPEND') ->headStyle($style3, 'APPEND'); $html = $this->helper->toString(); $doc = new DOMDocument; $dom = $doc->loadHtml($html); $this->assertTrue(($dom !== false)); $styles = substr_count($html, '<style type="text/css"'); $this->assertEquals(3, $styles); $styles = substr_count($html, '</style>'); $this->assertEquals(3, $styles); $this->assertContains($style3, $html); $this->assertContains($style2, $html); $this->assertContains($style1, $html); }