Closed emircanerkul closed 1 year ago
The issue here is that you don't configure what Query::condition
should return (and as there is no native return type, it returns null by default)
@stof thank you
This is how I did. If there is any better way, please let me know.
$query = $this->prophesize(QueryInterface::class);
$query->condition(Argument::any(), Argument::any())->willReturn($query);
$query->sort(Argument::any(), Argument::any())->willReturn($query);
$query->range(Argument::any(), Argument::any())->willReturn($query);
$query->execute()->willReturn([1]);
Okay, thank you
Test File:
I got
Call to a member function sort() on null
error. But it should return itself.At the end execute method I'll override the data as needed but before this, I need to run chained methods which return themselves. How can I do that? Shouldn't this be done automatically?