view = new Zend_View(); $this->helper = new Zend_View_Helper_Fieldset(); $this->helper->setView($this->view); ob_start(); } /** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @return void */ public function tearDown() { ob_end_clean(); } public function testFieldsetHelperCreatesFieldsetWithProvidedContent() { $html = $this->helper->fieldset('foo', 'foobar'); $this->assertRegexp('#]+id="foo".*?>#', $html); $this->assertContains('', $html); $this->assertContains('foobar', $html); } public function testProvidingLegendOptionToFieldsetCreatesLegendTag() { $html = $this->helper->fieldset('foo', 'foobar', array('legend' => 'Great Scott!')); $this->assertRegexp('#Great Scott!#', $html); } /** * @see ZF-2913 */ public function testEmptyLegendShouldNotRenderLegendTag() { foreach (array(null, '', ' ', false) as $legend) { $html = $this->helper->fieldset('foo', 'foobar', array('legend' => $legend)); $this->assertNotContains('', $html, 'Failed with value ' . var_export($legend, 1) . ': ' . $html); } } /** * @group ZF-3632 */ public function testHelperShouldAllowDisablingEscapingOfLegend() { $html = $this->helper->fieldset('foo', 'foobar', array('legend' => 'Great Scott!', 'escape' => false)); $this->assertRegexp('#Great Scott!#', $html, $html); } } // Call Zend_View_Helper_FieldsetTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_FieldsetTest::main") { Zend_View_Helper_FieldsetTest::main(); }