mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Reimplements the new toHaveArray features.
This commit is contained in:
@ -3,13 +3,13 @@
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKeys(['a', 'c']);
|
||||
expect(['a' => 1, 'b', 'c' => 'world', 'foo' => ['bar' => 'baz']])->toHaveKeys(['a', 'c', 'foo.bar']);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKeys(['a', 'd']);
|
||||
expect(['a' => 1, 'b', 'c' => 'world', 'foo' => ['bar' => 'baz']])->toHaveKeys(['a', 'd', 'foo.bar', 'hello.world']);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(['a' => 1, 'hello' => 'world', 'c'])->not->toHaveKeys(['hello', 'c']);
|
||||
expect(['a' => 1, 'b', 'c' => 'world', 'foo' => ['bar' => 'baz']])->not->toHaveKeys(['foo.bar', 'c', 'z']);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
Reference in New Issue
Block a user