@@ -57,6 +57,10 @@ public function printResult(TestResult $result): void
5757 */
5858 public function addError (Test $ test , \Throwable $ t , float $ time ): void
5959 {
60+ if (!$ test instanceof TestCase) {
61+ return ;
62+ }
63+
6064 $ this ->printEvent (
6165 'testFailed ' ,
6266 [
@@ -75,6 +79,10 @@ public function addError(Test $test, \Throwable $t, float $time): void
7579 */
7680 public function addWarning (Test $ test , Warning $ e , float $ time ): void
7781 {
82+ if (!$ test instanceof TestCase) {
83+ return ;
84+ }
85+
7886 $ this ->printEvent (
7987 'testFailed ' ,
8088 [
@@ -93,6 +101,10 @@ public function addWarning(Test $test, Warning $e, float $time): void
93101 */
94102 public function addFailure (Test $ test , AssertionFailedError $ e , float $ time ): void
95103 {
104+ if (!$ test instanceof TestCase) {
105+ return ;
106+ }
107+
96108 $ parameters = [
97109 'name ' => $ test ->getName (),
98110 'message ' => self ::getMessage ($ e ),
@@ -132,6 +144,10 @@ public function addFailure(Test $test, AssertionFailedError $e, float $time): vo
132144 */
133145 public function addIncompleteTest (Test $ test , \Throwable $ t , float $ time ): void
134146 {
147+ if (!$ test instanceof TestCase) {
148+ return ;
149+ }
150+
135151 $ this ->printIgnoredTest ($ test ->getName (), $ t , $ time );
136152 }
137153
@@ -142,6 +158,10 @@ public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
142158 */
143159 public function addRiskyTest (Test $ test , \Throwable $ t , float $ time ): void
144160 {
161+ if (!$ test instanceof TestCase) {
162+ return ;
163+ }
164+
145165 $ this ->addError ($ test , $ t , $ time );
146166 }
147167
@@ -152,6 +172,10 @@ public function addRiskyTest(Test $test, \Throwable $t, float $time): void
152172 */
153173 public function addSkippedTest (Test $ test , \Throwable $ t , float $ time ): void
154174 {
175+ if (!$ test instanceof TestCase) {
176+ return ;
177+ }
178+
155179 $ testName = $ test ->getName ();
156180
157181 if ($ this ->startedTestName !== $ testName ) {
@@ -253,6 +277,10 @@ public function endTestSuite(TestSuite $suite): void
253277 */
254278 public function startTest (Test $ test ): void
255279 {
280+ if (!$ test instanceof TestCase) {
281+ return ;
282+ }
283+
256284 $ testName = $ test ->getName ();
257285 $ this ->startedTestName = $ testName ;
258286 $ params = ['name ' => $ testName ];
@@ -271,6 +299,10 @@ public function startTest(Test $test): void
271299 */
272300 public function endTest (Test $ test , float $ time ): void
273301 {
302+ if (!$ test instanceof TestCase) {
303+ return ;
304+ }
305+
274306 parent ::endTest ($ test , $ time );
275307
276308 $ this ->printEvent (
0 commit comments