Implemented ActionHandlerServiceIntegrationTest

This commit is contained in:
Kevin Frantz 2019-02-16 10:47:41 +01:00
parent 0bdcdd7610
commit 9417e4ac7a
5 changed files with 67 additions and 6 deletions

View File

@ -60,4 +60,7 @@ services:
App\Domain\SecureManagement\SecureRequestedRightCheckerService:
public: true
App\Domain\ActionManagement\ActionService:
public: true
public: true
App\Domain\ActionManagement\ActionHandlerService:
public: true

View File

@ -10,6 +10,9 @@ use App\Domain\FixtureManagement\FixtureSource\FixtureSourceInterface;
*/
final class FixtureSourceFactory implements FixtureSourceFactoryInterface
{
/**
* @var string Namespace in which the fixture sources are saved
*/
const FIXTURE_SOURCE_NAMESPACE = 'App\Domain\FixtureManagement\FixtureSource';
/**

View File

@ -2,7 +2,6 @@
namespace App\Domain\RightManagement;
use App\Domain\RequestManagement\Right\RequestedRight;
use App\Entity\Meta\RightInterface;
use App\Domain\RequestManagement\Right\RequestedRightInterface;
use App\Entity\Meta\Right;
@ -12,10 +11,19 @@ use App\Entity\Meta\Right;
*/
final class RightTransformerService implements RightTransformerServiceInterface
{
/**
* @var string Prefix for setter functions
*/
const SET_PREFIX = 'set';
/**
* @var string Prefix for getter functions
*/
const GET_PREFIX = 'get';
/**
* @var string Prefix for has functions
*/
const HAS_PREFIX = 'has';
/**
@ -126,7 +134,7 @@ final class RightTransformerService implements RightTransformerServiceInterface
*
* @see \App\Domain\RightManagement\RightTransformerServiceInterface::transform()
*/
public function transform(RequestedRight $requestedRight): RightInterface
public function transform(RequestedRightInterface $requestedRight): RightInterface
{
$right = new Right();
$attributes = $this->getAttributesExistInBoth($right, $requestedRight);

View File

@ -3,7 +3,7 @@
namespace App\Domain\RightManagement;
use App\Entity\Meta\RightInterface;
use App\Domain\RequestManagement\Right\RequestedRight;
use App\Domain\RequestManagement\Right\RequestedRightInterface;
/**
* Allows to transform an Requested Right to a Entity Right.
@ -13,9 +13,9 @@ use App\Domain\RequestManagement\Right\RequestedRight;
interface RightTransformerServiceInterface
{
/**
* @param RequestedRight $requestedRight
* @param RequestedRightInterface $requestedRight
*
* @return RightInterface
*/
public function transform(RequestedRight $requestedRight): RightInterface;
public function transform(RequestedRightInterface $requestedRight): RightInterface;
}

View File

@ -0,0 +1,47 @@
<?php
namespace tests\Integration\Domain\ActionManagement;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use App\Domain\ActionManagement\ActionHandlerServiceInterface;
use App\Domain\RequestManagement\Action\RequestedActionServiceInterface;
use App\Domain\FixtureManagement\FixtureSource\ImpressumFixtureSource;
use App\Entity\Source\SourceInterface;
use App\DBAL\Types\ActionType;
use App\DBAL\Types\Meta\Right\LayerType;
/**
* @author kevinfrantz
*/
class ActionHandlerServiceIntegrationTest extends KernelTestCase
{
/**
* @var ActionHandlerServiceInterface
*/
private $actionHandlerService;
/**
* @var RequestedActionServiceInterface
*/
private $requestedActionService;
/**
* {@inheritdoc}
*
* @see \PHPUnit\Framework\TestCase::setUp()
*/
public function setUp(): void
{
self::bootKernel();
$this->actionHandlerService = self::$container->get(ActionHandlerServiceInterface::class);
$this->requestedActionService = self::$container->get(RequestedActionServiceInterface::class);
}
public function testEnityManager(): void
{
$this->requestedActionService->getRequestedEntity()->setSlug(ImpressumFixtureSource::SLUG);
$this->requestedActionService->setActionType(ActionType::READ);
$this->requestedActionService->setLayer(LayerType::SOURCE);
$this->assertInstanceOf(SourceInterface::class, $this->actionHandlerService->handle());
}
}