public function testValidateOneChildFail()
 {
     $data = array('field1' => 'VALUE1', 'field2' => array('field3' => '', 'field4' => 'value3'));
     $this->assertFalse($this->_validateCollection->isValid($data));
     $messages = $this->_validateCollection->getMessages();
     $errorField = 'field2.field3';
     $this->assertArrayHasKey($errorField, $messages);
     $errorMessage = $messages[$errorField];
     $this->assertArrayHasKey(Zend_Validate_NotEmpty::IS_EMPTY, $errorMessage);
     $this->assertArrayHasKey(Zend_Validate_InArray::NOT_IN_ARRAY, $errorMessage);
     $this->assertEquals(2, count($errorMessage));
 }
Пример #2
0
 public function testFilterValidateAllFailExceptNotRequired()
 {
     $data = array('field1' => 'valukjugle1', 'field3' => 'li');
     $this->assertFalse($this->_validateCollection->isValid($data));
     $messages = $this->_validateCollection->getMessages();
     $this->assertNotEmpty($messages);
     $this->assertArrayHasKey('field1', $messages);
     $this->assertArrayNotHasKey('field2', $messages);
     $this->assertArrayHasKey('field3', $messages);
 }