Completed
Push — master ( 7fe5eb...9bad48 )
by Beñat
08:54 queued 04:27
created

getNegativeFailureException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\Notifier\Tests\Matchers;
16
17
use Kreta\Notifier\Domain\Model\Inbox\Notification\NotificationStatus;
18
use PhpSpec\Exception\Example\FailureException;
19
use PhpSpec\Matcher\BasicMatcher;
20
21
/**
22
 * Usage:
23
 *    $this->shouldBeAReadNotificationStatus();.
24
 */
25 View Code Duplication
class ReadNotificationStatusMatcher extends BasicMatcher
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
{
27
    protected function matches($subject, array $arguments) : bool
28
    {
29
        return $subject->status() === 'read';
30
    }
31
32
    protected function getFailureException($name, $subject, array $arguments) : FailureException
33
    {
34
        return new FailureException(
35
            sprintf(
36
                'Expected a "read" notification status. Found a "%s" notification status.',
37
                $subject->status()
38
            )
39
        );
40
    }
41
42
    protected function getNegativeFailureException($name, $subject, array $arguments) : FailureException
43
    {
44
        return $this->getFailureException($name, $subject, $arguments);
45
    }
46
47
    public function supports($name, $subject, array $arguments) : bool
48
    {
49
        return $name === 'beAReadNotificationStatus' && $subject instanceof NotificationStatus;
50
    }
51
}
52