Skip to content

Commit

Permalink
test: Set::keys() and Set::values() returns the same value
Browse files Browse the repository at this point in the history
  • Loading branch information
rudashi committed Sep 27, 2024
1 parent 82cd6f5 commit 7c428ff
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Unit/SetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,14 @@
->current()?->toBe('foo')
->next()?->toBe('bar');
});

test('keys are equivalent to values()', function () {
$set = new Set(['foo' => 'bar']);

expect($set->keys())
->toBeInstanceOf(SetIterator::class)
->toArray()->toBe($set->values()->toArray());
});
});

describe('values', function () {
Expand All @@ -411,6 +419,14 @@
->current()?->toBe('bar')
->next()?->toBe('boo');
});

test('is equivalent to keys() method', function () {
$set = new Set(['foo', 'bar']);

expect($set->values())
->toBeInstanceOf(SetIterator::class)
->toArray()->toBe($set->keys()->toArray());
});
});

describe('magic methods', function () {
Expand Down

0 comments on commit 7c428ff

Please sign in to comment.