Skip to content

Commit

Permalink
Add has() method
Browse files Browse the repository at this point in the history
  • Loading branch information
cerbero90 committed Oct 28, 2024
1 parent ce404f8 commit 2912629
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/CasesCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@
->all()
->toBe([PureEnum::one, PureEnum::two, PureEnum::three]);

it('determines whether a pure collection contains an item', function() {
$collection = new CasesCollection(PureEnum::cases());

expect($collection->has(PureEnum::one))->toBeTrue();
expect($collection->has('one'))->toBeTrue();
expect($collection->has(BackedEnum::one))->toBeFalse();
expect($collection->has('four'))->toBeFalse();
expect($collection->has(1))->toBeFalse();
});

it('determines whether a backed collection contains an item', function() {
$collection = new CasesCollection(BackedEnum::cases());

expect($collection->has(BackedEnum::one))->toBeTrue();
expect($collection->has(1))->toBeTrue();
expect($collection->has(PureEnum::one))->toBeFalse();
expect($collection->has(4))->toBeFalse();
expect($collection->has('one'))->toBeFalse();
});

it('retrieves the count of all the cases')
->expect(new CasesCollection(PureEnum::cases()))
->count()
Expand Down

0 comments on commit 2912629

Please sign in to comment.