mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Implemented ActionHandlerServiceIntegrationTest
This commit is contained in:
parent
0bdcdd7610
commit
9417e4ac7a
@ -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
|
||||
|
@ -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';
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user