Skip to content

Commit 3507898

Browse files
committed
ITT: New reflection asserts added.
1 parent 9ff666e commit 3507898

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Asserts/ReflectionAsserts.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44

55
trait ReflectionAsserts
66
{
7+
protected function assertSubclassOf($class, $parent)
8+
{
9+
$message = "Failed asserting that class `{$class}` is subclass of `{$parent}`.";
10+
$this->assertTrue(is_subclass_of($class, $parent), $message);
11+
}
12+
13+
protected function assertNotSubclassOf($class, $parent)
14+
{
15+
$message = "Failed asserting that class `{$class}` is not subclass of `{$parent}`.";
16+
$this->assertFalse(is_subclass_of($class, $parent), $message);
17+
}
18+
719
protected function assertTraitUsed($class, $trait)
820
{
921
$message = "Failed asserting that class `{$class}` is using trait `{$trait}`.";

0 commit comments

Comments
 (0)