view = new Zend_View(); $this->view->doctype('HTML4_LOOSE'); // Reset doctype to default $this->helper = new Zend_View_Helper_FormImage(); $this->helper->setView($this->view); } /** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @access protected */ protected function tearDown() { } public function testFormImageRendersFormImageXhtml() { $button = $this->helper->formImage('foo', 'bar'); $this->assertRegexp('/]*?src="bar"/', $button); $this->assertRegexp('/]*?name="foo"/', $button); $this->assertRegexp('/]*?type="image"/', $button); } public function testDisablingFormImageRendersImageInputWithDisableAttribute() { $button = $this->helper->formImage('foo', 'bar', array('disable' => true)); $this->assertRegexp('/]*?disabled="disabled"/', $button); $this->assertRegexp('/]*?src="bar"/', $button); $this->assertRegexp('/]*?name="foo"/', $button); $this->assertRegexp('/]*?type="image"/', $button); } /** * @group ZF-11477 */ public function testRendersAsHtmlByDefault() { $test = $this->helper->formImage(array( 'name' => 'foo', )); $this->assertNotContains(' />', $test); } /** * @group ZF-11477 */ public function testCanRendersAsXHtml() { $this->view->doctype('XHTML1_STRICT'); $test = $this->helper->formImage(array( 'name' => 'foo', )); $this->assertContains(' />', $test); } } // Call Zend_View_Helper_FormImageTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_FormImageTest::main") { Zend_View_Helper_FormImageTest::main(); }