view = $this->getView();
$this->helper = new Zend_Dojo_View_Helper_NumberTextBox();
$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->numberTextBox(
'elementId',
'2008-07-07',
array(
'required' => true,
'constraints' => '{min:-20000,max:20000,places:0}',
),
array()
);
}
public function testShouldAllowDeclarativeDijitCreation()
{
$html = $this->getElement();
$this->assertRegexp('/]*(dojoType="dijit.form.NumberTextBox")/', $html, $html);
}
public function testShouldAllowProgrammaticDijitCreation()
{
Zend_Dojo_View_Helper_Dojo::setUseProgrammatic();
$html = $this->getElement();
$this->assertNotRegexp('/]*(dojoType="dijit.form.NumberTextBox")/', $html);
$this->assertNotNull($this->view->dojo()->getDijit('elementId'));
}
public function testShouldCreateTextInput()
{
$html = $this->getElement();
$this->assertRegexp('/]*(type="text")/', $html);
}
}
// Call Zend_Dojo_View_Helper_NumberTextBoxTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_Dojo_View_Helper_NumberTextBoxTest::main") {
Zend_Dojo_View_Helper_NumberTextBoxTest::main();
}