private function getForm($collection, $id = null, $type = null) { $form = new Admin_Form_Collection(); $form->populateFromModel($collection); if ($collection->isNewRecord()) { $form->setAction($this->view->url(array('action' => 'create', 'id' => $id, 'type' => $type))); } else { $form->setAction($this->view->url(array('action' => 'create', 'oid' => $collection->getId(), 'id' => $id, 'type' => $type))); } return $form; }
public function testValidationFailure() { $form = new Admin_Form_Collection(); $this->assertFalse($form->isValid(array())); $errors = $form->getErrors('Name'); $this->assertNotNull($errors); $this->assertContains('allElementsEmpty', $errors); $errors = $form->getErrors('Number'); $this->assertNotNull($errors); $this->assertContains('allElementsEmpty', $errors); }