mirror of
https://github.com/pestphp/pest.git
synced 2026-09-05 14:23:34 +02:00
chore: refactors exceptions
This commit is contained in:
@@ -24,7 +24,7 @@ test('pass with value check and plain key with dots')->expect($test_array)->toHa
|
||||
|
||||
test('failures', function () use ($test_array): void {
|
||||
expect($test_array)->toHaveKey('foo');
|
||||
})->throws(ExpectationFailedException::class, "Failed asserting that an array has the key 'foo'");
|
||||
})->throws(ExpectationFailedException::class, 'Failed asserting that an array has the key [foo]');
|
||||
|
||||
test('failures with custom message', function () use ($test_array): void {
|
||||
expect($test_array)->toHaveKey('foo', message: 'oh no!');
|
||||
@@ -36,7 +36,7 @@ test('failures with custom message and Any matcher', function () use ($test_arra
|
||||
|
||||
test('failures with nested key', function () use ($test_array): void {
|
||||
expect($test_array)->toHaveKey('d.bar');
|
||||
})->throws(ExpectationFailedException::class, "Failed asserting that an array has the key 'd.bar'");
|
||||
})->throws(ExpectationFailedException::class, 'Failed asserting that an array has the key [d.bar]');
|
||||
|
||||
test('failures with nested key and custom message', function () use ($test_array): void {
|
||||
expect($test_array)->toHaveKey('d.bar', message: 'oh no!');
|
||||
@@ -48,7 +48,7 @@ test('failures with nested key and custom message with Any matcher', function ()
|
||||
|
||||
test('failures with plain key with dots', function () use ($test_array): void {
|
||||
expect($test_array)->toHaveKey('missing.key.with.dots');
|
||||
})->throws(ExpectationFailedException::class, "Failed asserting that an array has the key 'missing.key.with.dots'");
|
||||
})->throws(ExpectationFailedException::class, 'Failed asserting that an array has the key [missing.key.with.dots]');
|
||||
|
||||
test('fails with wrong value', function () use ($test_array): void {
|
||||
expect($test_array)->toHaveKey('c', 'bar');
|
||||
|
||||
Reference in New Issue
Block a user