• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / PHPUnit-Polyfills / 12731053486

12 Jan 2025 06:11AM UTC coverage: 97.912%. Remained the same
12731053486

Pull #234

github

web-flow
Merge b818fae1d into 33d5b8d5d
Pull Request #234: Composer/lint: remove redundant duplicate script

797 of 814 relevant lines covered (97.91%)

127.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/TestListeners/TestListenerDefaultImplementationPHPUnit6.php
1
<?php
2

3
namespace Yoast\PHPUnitPolyfills\TestListeners;
4

5
use Exception;
6
use PHPUnit\Framework\AssertionFailedError;
7
use PHPUnit\Framework\Test;
8
use PHPUnit\Framework\TestSuite;
9
use PHPUnit\Framework\Warning;
10

11
/**
12
 * Basic TestListener implementation for use with PHPUnit 6.x.
13
 *
14
 * This TestListener trait uses renamed (snakecase) methods for all standard methods in
15
 * a TestListener to get round the method signature changes in various PHPUnit versions.
16
 *
17
 * When using this TestListener trait, the snake_case method names need to be used to implement
18
 * the listener functionality.
19
 *
20
 * @since 0.2.0
21
 */
22
trait TestListenerDefaultImplementation {
23

24
        use TestListenerSnakeCaseMethods;
25

26
        /**
27
         * An error occurred.
28
         *
29
         * @param Test      $test Test object.
30
         * @param Exception $e    Instance of the error encountered.
31
         * @param float     $time Execution time of this test.
32
         *
33
         * @return void
34
         */
35
        public function addError( Test $test, Exception $e, $time ) {
4✔
36
                $this->add_error( $test, $e, $time );
4✔
37
        }
4✔
38

39
        /**
40
         * A warning occurred.
41
         *
42
         * This method is only functional in PHPUnit 6.0 and above.
43
         *
44
         * @param Test    $test Test object.
45
         * @param Warning $e    Instance of the warning encountered.
46
         * @param float   $time Execution time of this test.
47
         *
48
         * @return void
49
         */
50
        public function addWarning( Test $test, Warning $e, $time ) {
4✔
51
                $this->add_warning( $test, $e, $time );
4✔
52
        }
4✔
53

54
        /**
55
         * A failure occurred.
56
         *
57
         * @param Test                 $test Test object.
58
         * @param AssertionFailedError $e    Instance of the assertion failure exception encountered.
59
         * @param float                $time Execution time of this test.
60
         *
61
         * @return void
62
         */
63
        public function addFailure( Test $test, AssertionFailedError $e, $time ) {
4✔
64
                $this->add_failure( $test, $e, $time );
4✔
65
        }
4✔
66

67
        /**
68
         * Incomplete test.
69
         *
70
         * @param Test      $test Test object.
71
         * @param Exception $e    Instance of the incomplete test exception.
72
         * @param float     $time Execution time of this test.
73
         *
74
         * @return void
75
         */
76
        public function addIncompleteTest( Test $test, Exception $e, $time ) {
4✔
77
                $this->add_incomplete_test( $test, $e, $time );
4✔
78
        }
4✔
79

80
        /**
81
         * Risky test.
82
         *
83
         * @param Test      $test Test object.
84
         * @param Exception $e    Instance of the risky test exception.
85
         * @param float     $time Execution time of this test.
86
         *
87
         * @return void
88
         */
89
        public function addRiskyTest( Test $test, Exception $e, $time ) {
4✔
90
                $this->add_risky_test( $test, $e, $time );
4✔
91
        }
4✔
92

93
        /**
94
         * Skipped test.
95
         *
96
         * @param Test      $test Test object.
97
         * @param Exception $e    Instance of the skipped test exception.
98
         * @param float     $time Execution time of this test.
99
         *
100
         * @return void
101
         */
102
        public function addSkippedTest( Test $test, Exception $e, $time ) {
4✔
103
                $this->add_skipped_test( $test, $e, $time );
4✔
104
        }
4✔
105

106
        /**
107
         * A test suite started.
108
         *
109
         * @param TestSuite $suite Test suite object.
110
         *
111
         * @return void
112
         */
113
        public function startTestSuite( TestSuite $suite ) {
×
114
                $this->start_test_suite( $suite );
×
115
        }
116

117
        /**
118
         * A test suite ended.
119
         *
120
         * @param TestSuite $suite Test suite object.
121
         *
122
         * @return void
123
         */
124
        public function endTestSuite( TestSuite $suite ) {
×
125
                $this->end_test_suite( $suite );
×
126
        }
127

128
        /**
129
         * A test started.
130
         *
131
         * @param Test $test Test object.
132
         *
133
         * @return void
134
         */
135
        public function startTest( Test $test ) {
28✔
136
                $this->start_test( $test );
28✔
137
        }
28✔
138

139
        /**
140
         * A test ended.
141
         *
142
         * @param Test  $test Test object.
143
         * @param float $time Execution time of this test.
144
         *
145
         * @return void
146
         */
147
        public function endTest( Test $test, $time ) {
28✔
148
                $this->end_test( $test, $time );
28✔
149
        }
28✔
150
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc