Skip to content

Commit

Permalink
Update MocksMixins.php
Browse files Browse the repository at this point in the history
  • Loading branch information
jarektkaczyk authored May 19, 2020
1 parent 6137862 commit ac17457
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/MocksMixins.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
*/
trait MocksMixins
{
/**
* Creates PHPUnit mock that mimics EloquentBuilder by allowing methods from QueryBuilder as well.
* By default PHPUnit mocks don't allow that, for EloquentBuilder is not extending QueryBuilder,
* and thus PHPUnit fails with error because the methods we try to mock or assert don't exist.
*
* @return MockObject|EloquentBuilder|QueryBuilder
*/
protected function mockEloquentBuilder(): MockObject
{
return $this->createMixinMock(EloquentBuilder::class, QueryBuilder::class);
Expand Down

0 comments on commit ac17457

Please sign in to comment.