8000 minor #14059 [DX]|Validator] Add PHPUnit hint in AbstractConstraintVa… · symfony/symfony@b9836b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit b9836b2

Browse files
committed
minor #14059 [DX]|Validator] Add PHPUnit hint in AbstractConstraintValidatorTest (lyrixx)
This PR was merged into the 2.7 branch. Discussion ---------- [DX]|Validator] Add PHPUnit hint in AbstractConstraintValidatorTest | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Fixed tickets | ~ | Tests pass? | ~ | License | MIT When one extends AbstractConstraintValidatorTest, If test fails the output is not very easy to understand because all "magic" is done in the parent class. So we have to read the code of the parent class to understand what happened. Commits ------- bebca0b |Validator] Add PHPUnit hint in AbstractConstraintValidatorTest
2 parents 37c137a + bebca0b commit b9836b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ protected function expectValidateValueAt($i, $propertyPath, $value, $constraints
244244

245245
protected function assertNoViolation()
246246
{
247-
$this->assertCount(0, $this->context->getViolations());
247+
$this->assertSame(0, $violationsCount = count($this->context->getViolations()), sprintf('0 violation expected. Got %u.', $violationsCount));
248248
}
249249

250250
/**
@@ -417,7 +417,7 @@ public function assertRaised()
417417

418418
$violations = iterator_to_array($this->context->getViolations());
419419

420-
\PHPUnit_Framework_Assert::assertCount(count($expected), $violations);
420+
\PHPUnit_Framework_Assert::assertSame($expectedCount = count($expected), $violationsCount = count($violations), sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount));
421421

422422
reset($violations);
423423

0 commit comments

Comments
 (0)
0