From 7701bf86a87cc90acdd1b9cb10b8b0112eb01b64 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 27 Jan 2019 09:35:43 +0100 Subject: [PATCH] Implemented ActionManagement --- .../Domain/ActionManagement/ActionService.php | 51 +++++++++++++++++++ .../ActionServiceInterface.php | 23 +++++++++ .../ActionManagement/ActionServiceTest.php | 31 +++++++++++ 3 files changed, 105 insertions(+) create mode 100644 application/symfony/src/Domain/ActionManagement/ActionService.php create mode 100644 application/symfony/src/Domain/ActionManagement/ActionServiceInterface.php create mode 100644 application/symfony/tests/Unit/Domain/ActionManagement/ActionServiceTest.php diff --git a/application/symfony/src/Domain/ActionManagement/ActionService.php b/application/symfony/src/Domain/ActionManagement/ActionService.php new file mode 100644 index 0000000..a41ed8e --- /dev/null +++ b/application/symfony/src/Domain/ActionManagement/ActionService.php @@ -0,0 +1,51 @@ +requestedAction = $requestedAction; + $this->secureRequestedRightChecker = $secureRequestedRightChecker; + } + + /** + * {@inheritdoc} + * + * @see \App\Domain\ActionManagement\ActionServiceInterface::getRequestedAction() + */ + public function getRequestedAction(): RequestedActionInterface + { + return $this->requestedAction; + } + + /** + * {@inheritdoc} + * + * @see \App\Domain\ActionManagement\ActionServiceInterface::isRequestedActionSecure() + */ + public function isRequestedActionSecure(): bool + { + return $this->secureRequestedRightChecker->check($this->requestedAction); + } +} diff --git a/application/symfony/src/Domain/ActionManagement/ActionServiceInterface.php b/application/symfony/src/Domain/ActionManagement/ActionServiceInterface.php new file mode 100644 index 0000000..7250d5f --- /dev/null +++ b/application/symfony/src/Domain/ActionManagement/ActionServiceInterface.php @@ -0,0 +1,23 @@ +createMock(RequestedActionInterface::class); + $secureRequestedRightChecker = $this->createMock(SecureRequestedRightCheckerInterface::class); + $secureRequestedRightChecker->method('check')->willReturn(true); + $actionService = new ActionService($requestedAction, $secureRequestedRightChecker); + $this->assertTrue($actionService->isRequestedActionSecure()); + } + + public function testRequestedActionGetter() + { + $requestedAction = $this->createMock(RequestedActionInterface::class); + $secureRequestedRightChecker = $this->createMock(SecureRequestedRightCheckerInterface::class); + $actionService = new ActionService($requestedAction, $secureRequestedRightChecker); + $this->assertInstanceOf(RequestedActionInterface::class, $actionService->getRequestedAction()); + } +}