Mock the HttpClient instead of making actual requests in tests
This commit is contained in:
parent
7ec09310b2
commit
3c5dfa9a3d
@ -13,6 +13,7 @@ use ActivityPub\Database\PrefixNamingStrategy;
|
||||
use ActivityPub\Test\TestUtils\TestDateTimeProvider;
|
||||
use Doctrine\ORM\Tools\Setup;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use PHPUnit\DbUnit\TestCaseTrait;
|
||||
|
||||
class ObjectsServiceTest extends SQLiteTestCase
|
||||
@ -44,7 +45,9 @@ class ObjectsServiceTest extends SQLiteTestCase
|
||||
'objects-service.create' => new DateTime( "12:00" ),
|
||||
'objects-service.update' => new DateTime( "12:01" ),
|
||||
) );
|
||||
$this->httpClient = new Client( array( 'http_errors' => false ) );
|
||||
$this->httpClient = $this->createMock( Client::class );
|
||||
$this->httpClient->method( 'send' )
|
||||
->willReturn( new Response( 404 ) );
|
||||
$this->objectsService = new ObjectsService(
|
||||
$this->entityManager, $this->dateTimeProvider, $this->httpClient
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user