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

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

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
trait TestListenerDefaultImplementation {
21

22
        use TestListenerSnakeCaseMethods;
23

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

35
        /**
36
         * A warning occurred.
37
         *
38
         * This method is only functional in PHPUnit 6.0 and above.
39
         *
40
         * @param Test    $test Test object.
41
         * @param Warning $e    Instance of the warning encountered.
42
         * @param float   $time Execution time of this test.
43
         */
44
        public function addWarning( Test $test, Warning $e, $time ) {
2✔
45
                $this->add_warning( $test, $e, $time );
2✔
46
        }
2✔
47

48
        /**
49
         * A failure occurred.
50
         *
51
         * @param Test                 $test Test object.
52
         * @param AssertionFailedError $e    Instance of the assertion failure exception encountered.
53
         * @param float                $time Execution time of this test.
54
         */
55
        public function addFailure( Test $test, AssertionFailedError $e, $time ) {
2✔
56
                $this->add_failure( $test, $e, $time );
2✔
57
        }
2✔
58

59
        /**
60
         * Incomplete test.
61
         *
62
         * @param Test      $test Test object.
63
         * @param Exception $e    Instance of the incomplete test exception.
64
         * @param float     $time Execution time of this test.
65
         */
66
        public function addIncompleteTest( Test $test, Exception $e, $time ) {
2✔
67
                $this->add_incomplete_test( $test, $e, $time );
2✔
68
        }
2✔
69

70
        /**
71
         * Risky test.
72
         *
73
         * @param Test      $test Test object.
74
         * @param Exception $e    Instance of the risky test exception.
75
         * @param float     $time Execution time of this test.
76
         */
77
        public function addRiskyTest( Test $test, Exception $e, $time ) {
2✔
78
                $this->add_risky_test( $test, $e, $time );
2✔
79
        }
2✔
80

81
        /**
82
         * Skipped test.
83
         *
84
         * @param Test      $test Test object.
85
         * @param Exception $e    Instance of the skipped test exception.
86
         * @param float     $time Execution time of this test.
87
         */
88
        public function addSkippedTest( Test $test, Exception $e, $time ) {
2✔
89
                $this->add_skipped_test( $test, $e, $time );
2✔
90
        }
2✔
91

92
        /**
93
         * A test suite started.
94
         *
95
         * @param TestSuite $suite Test suite object.
96
         */
97
        public function startTestSuite( TestSuite $suite ) {
×
98
                $this->start_test_suite( $suite );
×
99
        }
100

101
        /**
102
         * A test suite ended.
103
         *
104
         * @param TestSuite $suite Test suite object.
105
         */
106
        public function endTestSuite( TestSuite $suite ) {
×
107
                $this->end_test_suite( $suite );
×
108
        }
109

110
        /**
111
         * A test started.
112
         *
113
         * @param Test $test Test object.
114
         */
115
        public function startTest( Test $test ) {
14✔
116
                $this->start_test( $test );
14✔
117
        }
14✔
118

119
        /**
120
         * A test ended.
121
         *
122
         * @param Test  $test Test object.
123
         * @param float $time Execution time of this test.
124
         */
125
        public function endTest( Test $test, $time ) {
14✔
126
                $this->end_test( $test, $time );
14✔
127
        }
14✔
128
}
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