コード例 #1
0
 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);
 }
コード例 #2
0
 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());
 }