Passed
Push — master ( 4f9081...697711 )
by Julien
05:36 queued 02:27
created

Expect::aWarning()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
4
namespace Pitchart\Phlunit;
5
6
use PHPUnit\Framework\TestCase;
7
8
final class Expect
9
{
10
    /**
11
     * @var TestCase
12
     */
13
    private $testCase;
14
15
    /**
16
     * Expect constructor.
17
     *
18
     * @param TestCase $testCase
19
     */
20 10
    private function __construct(TestCase $testCase)
21
    {
22 10
        $this->testCase = $testCase;
23 10
    }
24
25 10
    public static function after(TestCase $testCase)
26
    {
27 10
        return new self($testCase);
28
    }
29
30 6
    public function anException(string $class = \Exception::class): self
31
    {
32 6
        $this->testCase->expectException($class);
33
34 6
        return $this;
35
    }
36
37 1
    public function describedBy(string $message): self
38
    {
39 1
        $this->testCase->expectExceptionMessage($message);
40
41 1
        return $this;
42
    }
43
44 1
    public function havingCode(int $code): self
45
    {
46 1
        $this->testCase->expectExceptionCode($code);
47
48 1
        return $this;
49
    }
50
51 1
    public function aDeprecation(): self
52
    {
53 1
        $this->testCase->expectDeprecation();
54
55 1
        return $this;
56
    }
57
58 1
    public function aNotice(): self
59
    {
60 1
        $this->testCase->expectNotice();
61
62 1
        return $this;
63
    }
64
65 1
    public function aWarning(): self
66
    {
67 1
        $this->testCase->expectWarning();
68
69 1
        return $this;
70
    }
71
72 1
    public function anError(): self
73
    {
74 1
        $this->testCase->expectError();
75
76 1
        return $this;
77
    }
78
79 1
    public function describedByAMessageMatching(string $pattern): self
80
    {
81 1
        $this->testCase->expectDeprecationMessageMatches($pattern);
82
83 1
        return $this;
84
    }
85
86 1
    public function describedByAMessageContaining(string $part): self
87
    {
88 1
        $this->testCase->expectDeprecationMessageMatches('/' . \preg_quote($part) . '/');
89
90 1
        return $this;
91
    }
92
}
93