mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Adds nested Higher Order Expectations.
This commit is contained in:
@ -59,6 +59,14 @@ it('can compose complex expectations', function () {
|
||||
);
|
||||
});
|
||||
|
||||
it('can handle nested method calls', function () {
|
||||
expect(new HasMethods())
|
||||
->newInstance()->newInstance()->name()->toEqual('Has Methods')->toBeString()
|
||||
->newInstance()->name()->toEqual('Has Methods')->not->toBeInt
|
||||
->name()->toEqual('Has Methods')
|
||||
->books()->each->toBeArray();
|
||||
});
|
||||
|
||||
class HasMethods
|
||||
{
|
||||
public function name()
|
||||
@ -97,4 +105,9 @@ class HasMethods
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function newInstance()
|
||||
{
|
||||
return new static();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user