entity = $this->createMock(EntityInterface::class); $this->requestedEntity = $this->createMock(RequestedEntityInterface::class); $this->requestedEntity->method('getEntity')->willReturn($this->entity); $this->requestedActionService = $this->createMock(RequestedActionServiceInterface::class); $this->requestedActionService->method('getRequestedEntity')->willReturn($this->requestedEntity); $this->secureRequestedRightCheckerService = $this->createMock(SecureRequestedRightCheckerServiceInterface::class); $this->requestedActionFormBuilderService = $this->createMock(RequestedActionFormBuilderServiceInterface::class); $this->requestStack = $this->createMock(RequestStack::class); $this->layerRepositoryFactoryService = $this->createMock(LayerRepositoryFactoryServiceInterface::class); $this->entityManager = $this->createMock(EntityManagerInterface::class); $this->actionService = new ActionDependenciesDAOService($this->requestedActionService, $this->secureRequestedRightCheckerService, $this->requestStack, $this->layerRepositoryFactoryService, $this->requestedActionFormBuilderService, $this->entityManager); } public function testIsRequestedActionSecure(): void { $this->secureRequestedRightCheckerService->method('check')->willReturn(true); $this->assertTrue($this->actionService->isRequestedActionSecure()); } public function testRequestedActionGetter(): void { $this->assertInstanceOf(RequestedActionInterface::class, $this->actionService->getRequestedAction()); } public function testGetEntityManager(): void { $this->assertEquals($this->entityManager, $this->actionService->getEntityManager()); } public function testGetRepository(): void { $repository = $this->createMock(RepositoryInterface::class); $this->layerRepositoryFactoryService->method('getRepository')->willReturn($repository); $result = $this->actionService->getRepository(); $this->assertEquals($repository, $result); } public function testGetRequest(): void { $request = $this->createMock(Request::class); $this->requestStack->method('getCurrentRequest')->willReturn($request); $result = $this->actionService->getRequest(); $this->assertEquals($request, $result); } public function testGetCurrentFormBuilder(): void { $form = $this->createMock(FormBuilderInterface::class); $this->requestedActionFormBuilderService->method('createByService')->willReturn($form); $result = $this->actionService->getCurrentFormBuilder(); $this->assertEquals($form, $result); } }