public function validateAssociated(Validatable $validatable) { $validatable->validate(); $this->_errors = array_merge($this->getErrorObjects(), $validatable->getErrorObjects()); $this->_errorFields = array_merge($this->_errorFields, $validatable->getErrorFields()); }
/** * @test */ public function shouldValidateAssociatedCollection() { // given $validatable = new Validatable(); $others = array(new ValidatableChild(array('error1'), array('errorField1')), new ValidatableChild(array('error2'), array('errorField2'))); // when $validatable->validateAssociatedCollection($others); // then Assert::thatArray($validatable->getErrors())->containsOnly('error1', 'error2'); Assert::thatArray($validatable->getErrorFields())->containsOnly('errorField1', 'errorField2'); }