Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update ConstraintValidatorTestCase.php
Make fail cases when no violations expected more informative
  • Loading branch information
apacheborys authored Jan 15, 2024
commit d557902ea31083bd26765cdaea4840e47d79962a
4 changes: 3 additions & 1 deletion Test/ConstraintValidatorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down