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

Yoast / PHPUnit-Polyfills / 10630772177

30 Aug 2024 10:04AM UTC coverage: 95.833%. Remained the same
10630772177

Pull #182

github

web-flow
Merge 95c68c44c into 28477a461
Pull Request #182: GH Actions: fix test run against PHPUnit "dev"

621 of 648 relevant lines covered (95.83%)

130.65 hits per line

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

77.78
/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
trait TestListenerDefaultImplementation {
27

28
        use TestListenerSnakeCaseMethods;
29

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

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

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

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

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

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

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

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

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

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