From f7b42c300617fe4d52cd6108e2caba53002d4796 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 16 Feb 2019 12:57:26 -0500 Subject: [PATCH] Fix tests --- src/Config/ActivityPubModule.php | 4 +++- test/Activities/CreateHandlerTest.php | 5 ++++- test/Controllers/GetControllerTest.php | 9 ++++++++- test/Objects/CollectionsServiceTest.php | 12 +++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Config/ActivityPubModule.php b/src/Config/ActivityPubModule.php index be5c50f..51d7ea7 100644 --- a/src/Config/ActivityPubModule.php +++ b/src/Config/ActivityPubModule.php @@ -94,7 +94,9 @@ class ActivityPubModule ->addArgument( new Reference( AuthService::class ) ) ->addArgument( new Reference( ContextProvider::class ) ) ->addArgument( new Reference( Client::class ) ) - ->addArgument( new Reference( SimpleDateTimeProvider::class ) ); + ->addArgument( new Reference( SimpleDateTimeProvider::class ) ) + ->addArgument( new Reference( EntityManager::class ) ) + ->addArgument( new Reference( ObjectsService::class ) ); $this->injector->register( RandomProvider::class, RandomProvider::class ); diff --git a/test/Activities/CreateHandlerTest.php b/test/Activities/CreateHandlerTest.php index 91ac13a..d384b21 100644 --- a/test/Activities/CreateHandlerTest.php +++ b/test/Activities/CreateHandlerTest.php @@ -13,6 +13,7 @@ use ActivityPub\Objects\ObjectsService; use ActivityPub\Test\TestConfig\APTestCase; use ActivityPub\Test\TestUtils\TestActivityPubObject; use ActivityPub\Utils\SimpleDateTimeProvider; +use Doctrine\ORM\EntityManager; use GuzzleHttp\Client; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; @@ -35,7 +36,9 @@ class CreateHandlerTest extends APTestCase $this->getMock( AuthService::class ), new ContextProvider(), $this->getMock( Client::class ), - new SimpleDateTimeProvider() + new SimpleDateTimeProvider(), + $this->getMock( EntityManager::class ), + $objectsService ); $createHandler = new CreateHandler( $objectsService, $idProvider, $collectionsService diff --git a/test/Controllers/GetControllerTest.php b/test/Controllers/GetControllerTest.php index d29918a..e81813e 100644 --- a/test/Controllers/GetControllerTest.php +++ b/test/Controllers/GetControllerTest.php @@ -10,6 +10,7 @@ use ActivityPub\Objects\ObjectsService; use ActivityPub\Test\TestConfig\APTestCase; use ActivityPub\Test\TestUtils\TestActivityPubObject; use ActivityPub\Utils\SimpleDateTimeProvider; +use Doctrine\ORM\EntityManager; use GuzzleHttp\Client; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -42,7 +43,13 @@ class GetControllerTest extends APTestCase $contextProvider = new ContextProvider(); $httpClient = $this->getMock( Client::class ); $collectionsService = new CollectionsService( - 4, $authService, $contextProvider, $httpClient, new SimpleDateTimeProvider() + 4, + $authService, + $contextProvider, + $httpClient, + new SimpleDateTimeProvider(), + $this->getMock( EntityManager::class ), + $objectsService ); $this->getController = new GetController( $objectsService, $collectionsService, $authService diff --git a/test/Objects/CollectionsServiceTest.php b/test/Objects/CollectionsServiceTest.php index fae4b64..7b799ef 100644 --- a/test/Objects/CollectionsServiceTest.php +++ b/test/Objects/CollectionsServiceTest.php @@ -5,9 +5,11 @@ namespace ActivityPub\Test\Objects; use ActivityPub\Auth\AuthService; use ActivityPub\Objects\CollectionsService; use ActivityPub\Objects\ContextProvider; +use ActivityPub\Objects\ObjectsService; use ActivityPub\Test\TestConfig\APTestCase; use ActivityPub\Test\TestUtils\TestActivityPubObject; use ActivityPub\Utils\SimpleDateTimeProvider; +use Doctrine\ORM\EntityManager; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Response as Psr7Response; use Symfony\Component\HttpFoundation\Request; @@ -34,8 +36,16 @@ class CollectionsServiceTest extends APTestCase ), ) ) ) ); + $entityManager = $this->getMock( EntityManager::class ); + $objectsService = $this->getMock( ObjectsService::class ); $this->collectionsService = new CollectionsService( - 4, $authService, $contextProvider, $httpClient, new SimpleDateTimeProvider() + 4, + $authService, + $contextProvider, + $httpClient, + new SimpleDateTimeProvider(), + $entityManager, + $objectsService ); }