generated from pestphp/pest-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
ToBeTrait.php
36 lines (31 loc) · 961 Bytes
/
ToBeTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
use Pest\Arch\Exceptions\ArchExpectationFailedException;
use Tests\Fixtures\Concerns\Deletable;
use Tests\Fixtures\Controllers\UserController;
it('passes', function () {
expect(Deletable::class)
->toBeTrait()
->and(UserController::class)
->not->toBeTrait();
});
it('fails 1', function () {
expect([UserController::class])->toBeTrait();
})->throws(
ArchExpectationFailedException::class,
"Expecting 'tests/Fixtures/Controllers/UserController.php' to be trait."
);
test('ignoring', function () {
expect('Tests\Fixtures\Concerns')
->toBeTrait()
->ignoring(UserController::class)
->not->toBeTrait()
->ignoring(Deletable::class);
});
test('ignoring opposite message', function () {
expect(Deletable::class)
->not
->toBeTrait();
})->throws(
ArchExpectationFailedException::class,
"Expecting 'tests/Fixtures/Concerns/Deletable.php' not to be trait."
);