mirror of
https://github.com/pestphp/pest.git
synced 2026-07-24 10:30:03 +02:00
fix: package lock fingerprint
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Pest\Arch\Exceptions\ArchExpectationFailedException;
|
||||
use Pest\Concerns\Retrievable;
|
||||
use Pest\Expectations\EachExpectation;
|
||||
use Pest\Expectations\HigherOrderExpectation;
|
||||
use Tests\Fixtures\Arch\ToUseTrait\HasInheritedTrait\ChildClassExtendingParent;
|
||||
use Tests\Fixtures\Arch\ToUseTrait\HasNestedTrait\NestedTrait;
|
||||
use Tests\Fixtures\Arch\ToUseTrait\HasTrait\ParentClassWithTrait;
|
||||
use Tests\Fixtures\Arch\ToUseTrait\HasTrait\TestTraitForInheritance;
|
||||
|
||||
test('pass', function () {
|
||||
expect('Pest\Expectations\HigherOrderExpectation')->toUseTrait('Pest\Concerns\Retrievable')
|
||||
->and('Pest\Expectations\EachExpectation')->not->toUseTrait('Pest\Concerns\Retrievable');
|
||||
test('pass', function (): void {
|
||||
expect(HigherOrderExpectation::class)->toUseTrait(Retrievable::class)
|
||||
->and(EachExpectation::class)->not->toUseTrait(Retrievable::class);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('Pest\Expectations\EachExpectation')->toUseTrait('Pest\Concerns\Foo');
|
||||
test('failures', function (): void {
|
||||
expect(EachExpectation::class)->toUseTrait('Pest\Concerns\Foo');
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect('Pest\Expectations\HigherOrderExpectation')->not->toUseTrait('Pest\Concerns\Retrievable');
|
||||
test('not failures', function (): void {
|
||||
expect(HigherOrderExpectation::class)->not->toUseTrait(Retrievable::class);
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
|
||||
test('trait inheritance - direct usage', function () {
|
||||
expect('Tests\Fixtures\Arch\ToUseTrait\HasTrait\ParentClassWithTrait')->toUseTrait('Tests\Fixtures\Arch\ToUseTrait\HasTrait\TestTraitForInheritance');
|
||||
test('trait inheritance - direct usage', function (): void {
|
||||
expect(ParentClassWithTrait::class)->toUseTrait(TestTraitForInheritance::class);
|
||||
});
|
||||
|
||||
test('trait inheritance - inherited usage', function () {
|
||||
expect('Tests\Fixtures\Arch\ToUseTrait\HasInheritedTrait\ChildClassExtendingParent')->toUseTrait('Tests\Fixtures\Arch\ToUseTrait\HasTrait\TestTraitForInheritance');
|
||||
test('trait inheritance - inherited usage', function (): void {
|
||||
expect(ChildClassExtendingParent::class)->toUseTrait(TestTraitForInheritance::class);
|
||||
});
|
||||
|
||||
test('trait inheritance - negative case', function () {
|
||||
expect('Tests\Fixtures\Arch\ToUseTrait\HasInheritedTrait\ChildClassExtendingParent')->not->toUseTrait('NonExistentTrait');
|
||||
test('trait inheritance - negative case', function (): void {
|
||||
expect(ChildClassExtendingParent::class)->not->toUseTrait('NonExistentTrait');
|
||||
});
|
||||
|
||||
test('nested trait inheritance', function () {
|
||||
expect('Tests\Fixtures\Arch\ToUseTrait\HasInheritedTrait\ChildClassExtendingParent')->toUseTrait('Tests\Fixtures\Arch\ToUseTrait\HasNestedTrait\NestedTrait');
|
||||
test('nested trait inheritance', function (): void {
|
||||
expect(ChildClassExtendingParent::class)->toUseTrait(NestedTrait::class);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user