Skip to content

Commit 1978f52

Browse files
committed
ITT: Trait asserts added.
1 parent 21f76fc commit 1978f52

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Asserts/TraitAsserts.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Illuminated\Testing\Asserts;
4+
5+
trait TraitAsserts
6+
{
7+
protected function assertTraitUsed($class, $trait)
8+
{
9+
$message = "Failed asserting that class `{$class}` is using trait `{$trait}`.";
10+
$this->assertContains($trait, class_uses($class), $message);
11+
}
12+
13+
protected function assertTraitNotUsed($class, $trait)
14+
{
15+
$message = "Failed asserting that class `{$class}` is not using trait `{$trait}`.";
16+
$this->assertNotContains($trait, class_uses($class), $message);
17+
}
18+
}

0 commit comments

Comments
 (0)