public function testWhenAFormIsVerifiedWithDataTheChangesAreReflectedToTheModel() { $newBook = new Book(); $data = array('title' => 'My New Book'); $newBookForm = new ZendX_Form_Doctrine($newBook); $this->assertTrue($newBookForm->isValid($data)); $this->assertEquals($data['title'], $newBook->title); }
public function testInvalidFormsContainMessagesForTheInvalidElements() { $record = new ValidationStub(); $form = new ZendX_Form_Doctrine($record); $message = 'This field should not be empty'; $form->setValidationMessage('stringValidation', 'notnull', $message); $this->assertFalse($form->isValid(array())); $this->assertContains($message, $form->getElement('stringValidation')->getErrorMessages()); }