Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit 03260c7

Browse files
Handle interfaces and traits
1 parent ae62799 commit 03260c7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ExistenceTrait.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ trait ExistenceTrait
2828
*/
2929
public function testExistence($class, $test)
3030
{
31-
$this->assertTrue(class_exists($class), "Expected the class {$class} to exist.");
32-
$this->assertTrue(class_exists($test), "Expected there to be tests for {$class}.");
31+
if ($interface = interface_exists($class)) {
32+
$this->assertTrue($interface, "Expected the interface {$class} to exist.");
33+
} elseif ($trait = trait_exists($class)) {
34+
$this->assertTrue($trait, "Expected the trait {$class} to exist.");
35+
} else {
36+
$this->assertTrue(class_exists($class), "Expected the class {$class} to exist.");
37+
$this->assertTrue(class_exists($test), "Expected there to be tests for {$class}.");
38+
}
3339
}
3440

3541
public function provideFilesToCheck()

0 commit comments

Comments
 (0)