You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
688 B

<?php
namespace Tests\Base;
use Illuminate\Support\Facades\Http;
trait MockMethodsTrait
{
protected function mockHttp(array $urls, $allowStrayRequest = false)
{
return $allowStrayRequest ?
Http::fake($urls) :
Http::preventStrayRequests()->fake($urls);
}
protected function mockHttpResponse($body = null, $status = 200, $headers = [])
{
return Http::response($body, $status, $headers);
}
protected function mockModel($model): \Mockery\MockInterface|array|\Mockery\LegacyMockInterface
{
app()->instance($model, $mockUserDocument = \Mockery::mock($model));
return $mockUserDocument;
}
}