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

Yoast / PHPUnit-Polyfills / 16579531037

28 Jul 2025 08:25PM UTC coverage: 63.368% (-32.5%) from 95.846%
16579531037

push

github

jrfnl
Merge branch '1.x' into 2.x

365 of 576 relevant lines covered (63.37%)

17.41 hits per line

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

0.0
/src/TestListeners/TestListenerDefaultImplementationPHPUnitLte5.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 5.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
 * {@internal While in essence this trait is no different from the PHPUnit 6.x version, this
21
 * version is necessary as the class/interface name type declarations used in the PHPUnit 6.x
22
 * file are based on the namespaced names. As both the namespaced names as well as the
23
 * non-namespaced names exist in PHPUnit 5.7.21+, we cannot create class aliases to
24
 * get round the signature mismatch and need this trait using the old names instead.}
25
 *
26
 * @since 0.2.0
27
 */
28
trait TestListenerDefaultImplementation {
29

30
        use TestListenerSnakeCaseMethods;
31

32
        /**
33
         * An error occurred.
34
         *
35
         * @param PHPUnit_Framework_Test $test Test object.
36
         * @param Exception              $e    Instance of the error encountered.
37
         * @param float                  $time Execution time of this test.
38
         *
39
         * @return void
40
         */
41
        public function addError( PHPUnit_Framework_Test $test, Exception $e, $time ) {
×
42
                $this->add_error( $test, $e, $time );
×
43
        }
44

45
        /**
46
         * A warning occurred.
47
         *
48
         * This method is only functional in PHPUnit 6.0 and above.
49
         *
50
         * @param PHPUnit_Framework_Test    $test Test object.
51
         * @param PHPUnit_Framework_Warning $e    Instance of the warning encountered.
52
         * @param float                     $time Execution time of this test.
53
         *
54
         * @return void
55
         */
56
        public function addWarning( PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time ) {
×
57
                $this->add_warning( $test, $e, $time );
×
58
        }
59

60
        /**
61
         * A failure occurred.
62
         *
63
         * @param PHPUnit_Framework_Test                 $test Test object.
64
         * @param PHPUnit_Framework_AssertionFailedError $e    Instance of the assertion failure
65
         *                                                     exception encountered.
66
         * @param float                                  $time Execution time of this test.
67
         *
68
         * @return void
69
         */
70
        public function addFailure( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time ) {
×
71
                $this->add_failure( $test, $e, $time );
×
72
        }
73

74
        /**
75
         * Incomplete test.
76
         *
77
         * @param PHPUnit_Framework_Test $test Test object.
78
         * @param Exception              $e    Instance of the incomplete test exception.
79
         * @param float                  $time Execution time of this test.
80
         *
81
         * @return void
82
         */
83
        public function addIncompleteTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
×
84
                $this->add_incomplete_test( $test, $e, $time );
×
85
        }
86

87
        /**
88
         * Risky test.
89
         *
90
         * @param PHPUnit_Framework_Test $test Test object.
91
         * @param Exception              $e    Instance of the risky test exception.
92
         * @param float                  $time Execution time of this test.
93
         *
94
         * @return void
95
         */
96
        public function addRiskyTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
×
97
                $this->add_risky_test( $test, $e, $time );
×
98
        }
99

100
        /**
101
         * Skipped test.
102
         *
103
         * @param PHPUnit_Framework_Test $test Test object.
104
         * @param Exception              $e    Instance of the skipped test exception.
105
         * @param float                  $time Execution time of this test.
106
         *
107
         * @return void
108
         */
109
        public function addSkippedTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
×
110
                $this->add_skipped_test( $test, $e, $time );
×
111
        }
112

113
        /**
114
         * A test suite started.
115
         *
116
         * @param PHPUnit_Framework_TestSuite $suite Test suite object.
117
         *
118
         * @return void
119
         */
120
        public function startTestSuite( PHPUnit_Framework_TestSuite $suite ) {
×
121
                $this->start_test_suite( $suite );
×
122
        }
123

124
        /**
125
         * A test suite ended.
126
         *
127
         * @param PHPUnit_Framework_TestSuite $suite Test suite object.
128
         *
129
         * @return void
130
         */
131
        public function endTestSuite( PHPUnit_Framework_TestSuite $suite ) {
×
132
                $this->end_test_suite( $suite );
×
133
        }
134

135
        /**
136
         * A test started.
137
         *
138
         * @param PHPUnit_Framework_Test $test Test object.
139
         *
140
         * @return void
141
         */
142
        public function startTest( PHPUnit_Framework_Test $test ) {
×
143
                $this->start_test( $test );
×
144
        }
145

146
        /**
147
         * A test ended.
148
         *
149
         * @param PHPUnit_Framework_Test $test Test object.
150
         * @param float                  $time Execution time of this test.
151
         *
152
         * @return void
153
         */
154
        public function endTest( PHPUnit_Framework_Test $test, $time ) {
×
155
                $this->end_test( $test, $time );
×
156
        }
157
}
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

© 2026 Coveralls, Inc