mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 01:37:21 +01:00
Adds nested Higher Order Expectations.
This commit is contained in:
@ -58,6 +58,12 @@ it('works with objects', function () {
|
||||
);
|
||||
});
|
||||
|
||||
it('works with nested properties', function () {
|
||||
expect(new HasProperties())
|
||||
->nested->foo->bar->toBeString()->toEqual('baz')
|
||||
->posts->toBeArray()->toHaveCount(2);
|
||||
});
|
||||
|
||||
class HasProperties
|
||||
{
|
||||
public $name = 'foo';
|
||||
@ -72,4 +78,8 @@ class HasProperties
|
||||
'title' => 'Bar',
|
||||
],
|
||||
];
|
||||
|
||||
public $nested = [
|
||||
'foo' => ['bar' => 'baz'],
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user