Fixes bug with json method call in Higher Order Expectations.

This commit is contained in:
Luke Downing
2022-01-21 16:35:21 +00:00
parent 1b7f1dc5b3
commit 2831629f1b
3 changed files with 18 additions and 1 deletions

View File

@ -74,8 +74,19 @@ it('works with higher order tests')
->name()->toEqual('Has Methods')
->books()->each->toBeArray;
it('can call the json method in higher order expectations', function () {
expect(new HasMethods())
->getJsonContent()->json()->id->toBe(1)->toBeGreaterThan(0)
->getJsonContent()->json()->email->toBe('amenophis@leherpeur.net');
});
class HasMethods
{
public function getJsonContent(): string
{
return '{"id":1,"username":"amenophis","email":"amenophis@leherpeur.net"}';
}
public function name()
{
return 'Has Methods';