Anything below top level form (
$this->view->form = $form; in controller) one needs to use the getElement() function like one would in the controller. getSubForm() is also valid if there are subforms:public function testRegisterViewObjectContainsProperties() {
$controller = new RegistrationController(
$this->request,
$this->response,
$this->request->getParams()
);
$controller->registerAction();
$this->assertTrue(isset($controller->view->form));
$this->assertTrue(isset($controller->view));
$this->assertTrue(isset($controller->view->form));
$username = $controller->view->form->getSubForm('userpass')->getElement('username');http://www.contentwithstyle.co.uk/content/unit-testing-controllers-with-zend-framework seems to be useful.
No comments:
Post a Comment