Skip to content

Commit

Permalink
[Tests] Fix usage of old PHPUnit class name in ValidationErrorOccurs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Mar 12, 2018
1 parent 5a694bc commit b18ea5d
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -8,13 +8,15 @@
*/
namespace eZ\Publish\API\Repository\Tests\PHPUnitConstraint;

use PHPUnit\Framework\Constraint\Constraint as AbstractPHPUnitConstraint;

/**
* PHPUnit constraint checking that the given ValidationError message occurs in asserted ContentFieldValidationException.
*
* @see \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
* @see \eZ\Publish\SPI\FieldType\ValidationError
*/
class ValidationErrorOccurs extends \PHPUnit_Framework_Constraint
class ValidationErrorOccurs extends AbstractPHPUnitConstraint
{
/**
* @var string
Expand All @@ -36,7 +38,7 @@ public function __construct($expectedValidationErrorMessage)
*
* @return bool
*/
protected function matches($other)
protected function matches($other): bool
{
foreach ($other->getFieldErrors() as $fieldId => $errors) {
foreach ($errors as $languageCode => $fieldErrors) {
Expand All @@ -57,7 +59,7 @@ protected function matches($other)
*
* @return string
*/
protected function failureDescription($other)
protected function failureDescription($other): string
{
return sprintf(
'%s::getFieldErrors = %s %s',
Expand All @@ -72,7 +74,7 @@ protected function failureDescription($other)
*
* @return string
*/
public function toString()
public function toString(): string
{
return "contains a ValidationError with the message '{$this->expectedValidationErrorMessage}'";
}
Expand Down

0 comments on commit b18ea5d

Please sign in to comment.