public static function assertErrorMessages(TestCase $testCase, ValidationResult $validationResult, array $expectedMessages)
 {
     $actualMessages = [];
     foreach ($validationResult->getValidationErrors() as $validationError) {
         $actualMessages[$validationError->getMessage()] = $validationError->getArguments();
     }
     $testCase->assertSame($expectedMessages, $actualMessages);
 }
Ejemplo n.º 2
0
 public function testMerge()
 {
     $validationResultA = new ValidationResult(new ValidationError('foo'));
     $validationResultB = new ValidationResult();
     $validationResultC = new ValidationResult(new ValidationError('bar'), new ValidationError('baz'));
     $validationResult = $validationResultA->merge($validationResultB)->merge($validationResultC);
     $this->assertFalse($validationResult->isSuccess());
     ValidationErrorAssertion::assertErrorMessages($this, $validationResult, ['foo' => [], 'bar' => [], 'baz' => []]);
 }