shouldReceive('audits')->once()->andReturn($audits); $audits->shouldReceive('with')->once()->with('user')->andReturnSelf(); $audits->shouldReceive('latest')->once()->andReturnSelf(); $audits->shouldReceive('limit')->once()->with(5)->andReturnSelf(); $audits->shouldReceive('get')->once()->andReturn(new Collection()); $query = new GetModelAuditLog(); $result = $query->get($model); expect($result)->toBeInstanceOf(Collection::class); });