mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
create Any matcher
This commit is contained in:
@ -512,8 +512,10 @@
|
||||
✓ pass with value check and plain key with dots
|
||||
✓ failures
|
||||
✓ failures with custom message
|
||||
✓ failures with custom message and Any matcher
|
||||
✓ failures with nested key
|
||||
✓ failures with nested key and custom message
|
||||
✓ failures with nested key and custom message with Any matcher
|
||||
✓ failures with plain key with dots
|
||||
✓ fails with wrong value
|
||||
✓ fails with wrong value and nested key
|
||||
@ -556,6 +558,7 @@
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ failures with message
|
||||
✓ failures with message and Any matcher
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Features\Expect\toMatch
|
||||
@ -815,4 +818,4 @@
|
||||
PASS Tests\Visual\Version
|
||||
✓ visual snapshot of help command output
|
||||
|
||||
Tests: 4 incomplete, 1 todo, 18 skipped, 559 passed (1450 assertions)
|
||||
Tests: 4 incomplete, 1 todo, 18 skipped, 562 passed (1460 assertions)
|
||||
@ -28,6 +28,10 @@ test('failures with custom message', function () use ($test_array) {
|
||||
expect($test_array)->toHaveKey('foo', failureMessage: 'oh no!');
|
||||
})->throws(ExpectationFailedException::class, 'oh no!');
|
||||
|
||||
test('failures with custom message and Any matcher', function () use ($test_array) {
|
||||
expect($test_array)->toHaveKey('foo', expect()->any(), 'oh no!');
|
||||
})->throws(ExpectationFailedException::class, 'oh no!');
|
||||
|
||||
test('failures with nested key', function () use ($test_array) {
|
||||
expect($test_array)->toHaveKey('d.bar');
|
||||
})->throws(ExpectationFailedException::class, "Failed asserting that an array has the key 'd.bar'");
|
||||
@ -36,6 +40,10 @@ test('failures with nested key and custom message', function () use ($test_array
|
||||
expect($test_array)->toHaveKey('d.bar', failureMessage: 'oh no!');
|
||||
})->throws(ExpectationFailedException::class, 'oh no!');
|
||||
|
||||
test('failures with nested key and custom message with Any matcher', function () use ($test_array) {
|
||||
expect($test_array)->toHaveKey('d.bar', expect()->any(), 'oh no!');
|
||||
})->throws(ExpectationFailedException::class, 'oh no!');
|
||||
|
||||
test('failures with plain key with dots', function () use ($test_array) {
|
||||
expect($test_array)->toHaveKey('missing.key.with.dots');
|
||||
})->throws(ExpectationFailedException::class, "Failed asserting that an array has the key 'missing.key.with.dots'");
|
||||
|
||||
@ -21,6 +21,10 @@ test('failures with message', function () use ($obj) {
|
||||
expect($obj)->toHaveProperty(name: 'bar', failureMessage: 'oh no!');
|
||||
})->throws(ExpectationFailedException::class, 'oh no!');
|
||||
|
||||
test('failures with message and Any matcher', function () use ($obj) {
|
||||
expect($obj)->toHaveProperty('bar', expect()->any(), 'oh no!');
|
||||
})->throws(ExpectationFailedException::class, 'oh no!');
|
||||
|
||||
test('not failures', function () use ($obj) {
|
||||
expect($obj)->not->toHaveProperty('foo');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
Reference in New Issue
Block a user