From bebca0b1b116c1785452e59db3b2360295a4eef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 25 Mar 2015 21:33:54 +0100 Subject: [PATCH] |Validator] Add PHPUnit hint in AbstractConstraintValidatorTest 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. --- .../Tests/Constraints/AbstractConstraintValidatorTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php index 140f8e49b4..55ddbfe9c8 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php @@ -244,7 +244,7 @@ abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCa protected function assertNoViolation() { - $this->assertCount(0, $this->context->getViolations()); + $this->assertSame(0, $violationsCount = count($this->context->getViolations()), sprintf('0 violation expected. Got %u.', $violationsCount)); } /** @@ -417,7 +417,7 @@ class ConstraintViolationAssertion $violations = iterator_to_array($this->context->getViolations()); - \PHPUnit_Framework_Assert::assertCount(count($expected), $violations); + \PHPUnit_Framework_Assert::assertSame($expectedCount = count($expected), $violationsCount = count($violations), sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount)); reset($violations);