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

Yoast / PHPUnit-Polyfills / 6985086800

24 Nov 2023 09:59PM UTC coverage: 96.708% (-0.6%) from 97.328%
6985086800

push

github

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

617 of 638 relevant lines covered (96.71%)

93.2 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
        public function addError( PHPUnit_Framework_Test $test, Exception $e, $time ) {
4✔
38
                $this->add_error( $test, $e, $time );
4✔
39
        }
4✔
40

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

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

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

77
        /**
78
         * Risky test.
79
         *
80
         * @param PHPUnit_Framework_Test $test Test object.
81
         * @param Exception              $e    Instance of the risky test exception.
82
         * @param float                  $time Execution time of this test.
83
         */
84
        public function addRiskyTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
×
85
                $this->add_risky_test( $test, $e, $time );
×
86
        }
87

88
        /**
89
         * Skipped test.
90
         *
91
         * @param PHPUnit_Framework_Test $test Test object.
92
         * @param Exception              $e    Instance of the skipped test exception.
93
         * @param float                  $time Execution time of this test.
94
         */
95
        public function addSkippedTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
4✔
96
                $this->add_skipped_test( $test, $e, $time );
4✔
97
        }
4✔
98

99
        /**
100
         * A test suite started.
101
         *
102
         * @param PHPUnit_Framework_TestSuite $suite Test suite object.
103
         */
104
        public function startTestSuite( PHPUnit_Framework_TestSuite $suite ) {
×
105
                $this->start_test_suite( $suite );
×
106
        }
107

108
        /**
109
         * A test suite ended.
110
         *
111
         * @param PHPUnit_Framework_TestSuite $suite Test suite object.
112
         */
113
        public function endTestSuite( PHPUnit_Framework_TestSuite $suite ) {
×
114
                $this->end_test_suite( $suite );
×
115
        }
116

117
        /**
118
         * A test started.
119
         *
120
         * @param PHPUnit_Framework_Test $test Test object.
121
         */
122
        public function startTest( PHPUnit_Framework_Test $test ) {
24✔
123
                $this->start_test( $test );
24✔
124
        }
24✔
125

126
        /**
127
         * A test ended.
128
         *
129
         * @param PHPUnit_Framework_Test $test Test object.
130
         * @param float                  $time Execution time of this test.
131
         */
132
        public function endTest( PHPUnit_Framework_Test $test, $time ) {
24✔
133
                $this->end_test( $test, $time );
24✔
134
        }
24✔
135
}
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