DelegatingListener::addFailure()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 3
crap 2
1
<?php
2
namespace Yoanm\PhpUnitExtended\Listener;
3
4
use PHPUnit\Framework\AssertionFailedError;
5
use PHPUnit\Framework\Test;
6
use PHPUnit\Framework\TestListener;
7
use PHPUnit\Framework\TestSuite;
8
use PHPUnit\Framework\Warning;
9
10
/**
11
 * Simple listener delegator
12
 */
13
class DelegatingListener implements TestListener
0 ignored issues
show
Deprecated Code introduced by
The interface PHPUnit\Framework\TestListener has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

13
class DelegatingListener implements /** @scrutinizer ignore-deprecated */ TestListener

This interface has been deprecated. The supplier of the interface has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.

Loading history...
14
{
15
    /** TestListener[] */
16
    private $listenerList = [];
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 11
    public function addListener(TestListener $listener) : void
22
    {
23 11
        $this->listenerList[] = $listener;
24
    }
25
26
    /**
27
     * @return TestListener[]
28
     */
29 1
    public function getListenerList()
30
    {
31 1
        return $this->listenerList;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 1
    public function addError(Test $test, \Throwable $e, float $time) : void
38
    {
39 1
        foreach ($this->listenerList as $listener) {
40 1
            $listener->addError($test, $e, $time);
41
        }
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 1
    public function addWarning(Test $test, Warning $e, float $time) : void
48
    {
49 1
        foreach ($this->listenerList as $listener) {
50 1
            $listener->addWarning($test, $e, $time);
51
        }
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 1
    public function addFailure(Test $test, AssertionFailedError $e, float $time) : void
58
    {
59 1
        foreach ($this->listenerList as $listener) {
60 1
            $listener->addFailure($test, $e, $time);
61
        }
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67 1
    public function addIncompleteTest(Test $test, \Throwable $e, float $time) : void
68
    {
69 1
        foreach ($this->listenerList as $listener) {
70 1
            $listener->addIncompleteTest($test, $e, $time);
71
        }
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77 1
    public function addRiskyTest(Test $test, \Throwable $exception, float $time) : void
78
    {
79 1
        foreach ($this->listenerList as $listener) {
80 1
            $listener->addRiskyTest($test, $exception, $time);
81
        }
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87 1
    public function addSkippedTest(Test $test, \Throwable $e, float $time) : void
88
    {
89 1
        foreach ($this->listenerList as $listener) {
90 1
            $listener->addSkippedTest($test, $e, $time);
91
        }
92
    }
93
94
    /**
95
     * {@inheritdoc}
96
     */
97 1
    public function startTestSuite(TestSuite $suite) : void
98
    {
99 1
        foreach ($this->listenerList as $listener) {
100 1
            $listener->startTestSuite($suite);
101
        }
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107 1
    public function endTestSuite(TestSuite $suite) : void
108
    {
109 1
        foreach ($this->listenerList as $listener) {
110 1
            $listener->endTestSuite($suite);
111
        }
112
    }
113
114
    /**
115
     * {@inheritdoc}
116
     */
117 1
    public function startTest(Test $test) : void
118
    {
119 1
        foreach ($this->listenerList as $listener) {
120 1
            $listener->startTest($test);
121
        }
122
    }
123
124
    /**
125
     * {@inheritdoc}
126
     */
127 1
    public function endTest(Test $test, float $time) : void
128
    {
129 1
        foreach ($this->listenerList as $listener) {
130 1
            $listener->endTest($test, $time);
131
        }
132
    }
133
}
134