view = $this->getView(); $this->element = $this->getElement(); $this->element->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() { $element = new Zend_Dojo_Form_Element_TextBox( 'foo', array( 'value' => 'some text', 'label' => 'TextBox', 'trim' => true, 'propercase' => true, 'class' => 'someclass', 'style' => 'width: 100px;', ) ); return $element; } public function testLowercaseAccessorsShouldProxyToDijitParams() { $this->assertFalse($this->element->getLowercase()); $this->assertFalse(array_key_exists('lowercase', $this->element->dijitParams)); $this->element->setLowercase(true); $this->assertTrue($this->element->getLowercase()); $this->assertTrue($this->element->dijitParams['lowercase']); } public function testPropercaseAccessorsShouldProxyToDijitParams() { $this->assertTrue($this->element->getPropercase()); $this->assertTrue(array_key_exists('propercase', $this->element->dijitParams)); $this->element->setPropercase(false); $this->assertFalse($this->element->getPropercase()); } public function testUppercaseAccessorsShouldProxyToDijitParams() { $this->assertFalse($this->element->getUppercase()); $this->assertFalse(array_key_exists('uppercase', $this->element->dijitParams)); $this->element->setUppercase(true); $this->assertTrue($this->element->getUppercase()); $this->assertTrue($this->element->dijitParams['uppercase']); } public function testTrimAccessorsShouldProxyToDijitParams() { $this->assertTrue($this->element->getTrim()); $this->assertTrue(array_key_exists('trim', $this->element->dijitParams)); $this->element->setTrim(false); $this->assertFalse($this->element->getTrim()); } public function testMaxLengthAccessorsShouldProxyToDijitParams() { $this->assertNull($this->element->getMaxLength()); $this->assertFalse(array_key_exists('maxLength', $this->element->dijitParams)); $this->element->setMaxLength(20); $this->assertEquals(20, $this->element->getMaxLength()); $this->assertEquals(20, $this->element->dijitParams['maxLength']); } } // Call Zend_Dojo_Form_Element_TextBoxTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_Dojo_Form_Element_TextBoxTest::main") { Zend_Dojo_Form_Element_TextBoxTest::main(); }