view = $this->getView(); $this->helper = new Zend_Dojo_View_Helper_SubmitButton(); $this->helper->setView($this->view); } /** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @return void */ public function tearDown() { } public function getView() { require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper'); return $view; } public function getElement() { return $this->helper->submitButton( 'elementId', 'foo', array(), array() ); } public function testShouldAllowDeclarativeDijitCreation() { $html = $this->getElement(); $this->assertRegexp('/]*(type="submit")/', $html, $html); $this->assertRegexp('/]*(dojoType="dijit.form.Button")/', $html, $html); $this->assertRegexp('/]*(label="foo")/', $html, $html); } public function testShouldAllowProgrammaticDijitCreation() { Zend_Dojo_View_Helper_Dojo::setUseProgrammatic(); $html = $this->getElement(); $this->assertNotRegexp('/]*(dojoType="dijit.form.Button")/', $html); $this->assertNotNull($this->view->dojo()->getDijit('elementId')); } /** * @group ZF-4977 */ public function testHelperShouldRenderContentKeyAsLabelWhenPassed() { $html = $this->helper->submitButton('foo', '', array('content' => 'Label')); $this->assertRegexp('/]*(value="Label")/', $html, $html); } } // Call Zend_Dojo_View_Helper_SubmitButtonTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_Dojo_View_Helper_SubmitButtonTest::main") { Zend_Dojo_View_Helper_SubmitButtonTest::main(); }