Completed
Push — 6.13.7 ( b1546d )
by
unknown
14:00
created

ValidationErrorOccurs::matches()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
nc 5
nop 1
dl 0
loc 15
rs 9.4555
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\API\Repository\Tests\PHPUnitConstraint;
10
11
/**
12
 * PHPUnit constraint checking that the given ValidationError message occurs in asserted ContentFieldValidationException.
13
 *
14
 * @see \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
15
 * @see \eZ\Publish\SPI\FieldType\ValidationError
16
 */
17
class ValidationErrorOccurs extends AllValidationErrorsOccur
18
{
19
    /** @var string */
20
    private $expectedValidationErrorMessage;
21
22
    /**
23
     * @param string $expectedValidationErrorMessage
24
     */
25
    public function __construct(string $expectedValidationErrorMessage)
26
    {
27
        $this->expectedValidationErrorMessage = $expectedValidationErrorMessage;
28
29
        parent::__construct([$expectedValidationErrorMessage]);
30
    }
31
32
    /**
33
     * Returns a string representation of the object.
34
     *
35
     * @return string
36
     */
37
    public function toString(): string
38
    {
39
        return "contain the message '{$this->expectedValidationErrorMessage}'";
40
    }
41
}
42