From d557902ea31083bd26765cdaea4840e47d79962a Mon Sep 17 00:00:00 2001 From: Borys Date: Mon, 15 Jan 2024 14:07:44 +0100 Subject: [PATCH] Update ConstraintValidatorTestCase.php Make fail cases when no violations expected more informative --- Test/ConstraintValidatorTestCase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Test/ConstraintValidatorTestCase.php b/Test/ConstraintValidatorTestCase.php index f808e49ba..423c6e0d1 100644 --- a/Test/ConstraintValidatorTestCase.php +++ b/Test/ConstraintValidatorTestCase.php @@ -276,7 +276,9 @@ protected function expectViolationsAt(int $i, mixed $value, Constraint $constrai protected function assertNoViolation() { - $this->assertSame(0, $violationsCount = \count($this->context->getViolations()), sprintf('0 violation expected. Got %u.', $violationsCount)); + $violations = $this->context->getViolations(); + + $this->assertSame(0, $violationsCount = \count($violations), sprintf('0 violation expected. Got %u. Violations: %s', $violationsCount, $violations)); } protected function buildViolation(string|\Stringable $message): ConstraintViolationAssertion