mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-18 19:09:20 +02:00
Covered Request Management Services with Unit Tests
This commit is contained in:
parent
06053c6bcf
commit
d1ff628087
@ -29,3 +29,5 @@ doctrine:
|
|||||||
dir: '%kernel.project_dir%/src/Entity'
|
dir: '%kernel.project_dir%/src/Entity'
|
||||||
prefix: 'App\Entity'
|
prefix: 'App\Entity'
|
||||||
alias: App
|
alias: App
|
||||||
|
#resolve_target_entities:
|
||||||
|
# App\Domain\RequestManagement\Right\RequestedRightServiceInterface: App\Domain\RequestManagement\Right\RequestedRightService2
|
@ -34,7 +34,7 @@ services:
|
|||||||
# this creates a service per class whose id is the fully-qualified class name
|
# this creates a service per class whose id is the fully-qualified class name
|
||||||
App\:
|
App\:
|
||||||
resource: '../src/*'
|
resource: '../src/*'
|
||||||
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
|
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Exception,Kernel.php}'
|
||||||
# controllers are imported separately to make sure services can be injected
|
# controllers are imported separately to make sure services can be injected
|
||||||
# as action arguments even if you don't extend any base controller class
|
# as action arguments even if you don't extend any base controller class
|
||||||
App\Controller\:
|
App\Controller\:
|
||||||
@ -47,3 +47,11 @@ services:
|
|||||||
# Needed for integration tests
|
# Needed for integration tests
|
||||||
App\Domain\RequestManagement\Entity\RequestedEntityService:
|
App\Domain\RequestManagement\Entity\RequestedEntityService:
|
||||||
public: true
|
public: true
|
||||||
|
App\Domain\RequestManagement\Right\RequestedRightService:
|
||||||
|
public: true
|
||||||
|
App\Domain\UserManagement\UserSourceDirectorService:
|
||||||
|
public: true
|
||||||
|
App\Domain\RequestManagement\User\RequestedUserService:
|
||||||
|
public: true
|
||||||
|
App\Domain\RequestManagement\Action\RequestedActionService:
|
||||||
|
public: true
|
@ -6,6 +6,7 @@ use App\Entity\UserInterface;
|
|||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use App\Entity\Source\AbstractSource;
|
use App\Entity\Source\AbstractSource;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -25,10 +26,10 @@ final class UserSourceDirectorService implements UserSourceDirectorServiceInterf
|
|||||||
private $security;
|
private $security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EntityManager $entityManager
|
* @param EntityManager $entityManagerInterface
|
||||||
* @param Security $security
|
* @param Security $security
|
||||||
*/
|
*/
|
||||||
public function __construct(EntityManager $entityManager, Security $security)
|
public function __construct(EntityManagerInterface $entityManager, Security $security)
|
||||||
{
|
{
|
||||||
$this->entityManager = $entityManager;
|
$this->entityManager = $entityManager;
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tests\Integration\Domain\RequestManagement\Right;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use App\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
|
||||||
|
use App\DBAL\Types\Meta\Right\LayerType;
|
||||||
|
use App\Repository\Meta\LawRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
class LayerRepositoryFactoryServiceIntegrationTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var LayerRepositoryFactoryServiceInterface
|
||||||
|
*/
|
||||||
|
private $layerRepositoryFactoryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
||||||
|
*/
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->layerRepositoryFactoryService = self::$container->get(LayerRepositoryFactoryServiceInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLayer(): void
|
||||||
|
{
|
||||||
|
$layer = LayerType::LAW;
|
||||||
|
$this->assertInstanceOf(LawRepository::class, $this->layerRepositoryFactoryService->getRepository($layer));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tests\Integration\Domain\RequestManagement\Action;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use App\Domain\RequestManagement\Action\RequestedActionServiceInterface;
|
||||||
|
use App\DBAL\Types\ActionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
class RequestedActionServiceIntegrationTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var RequestedActionServiceInterface
|
||||||
|
*/
|
||||||
|
private $requestedActionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
||||||
|
*/
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->requestedActionService = self::$container->get(RequestedActionServiceInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testActionAccessors(): void
|
||||||
|
{
|
||||||
|
$actionType = ActionType::THREAD;
|
||||||
|
$this->assertNull($this->requestedActionService->setActionType($actionType));
|
||||||
|
$this->assertEquals($actionType, $this->requestedActionService->getActionType());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tests\Integration\Domain\RequestManagement\Right;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use App\Domain\RequestManagement\Right\RequestedRightServiceInterface;
|
||||||
|
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
class RequestedRightServiceIntegrationTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var RequestedRightServiceInterface
|
||||||
|
*/
|
||||||
|
private $requestedRightService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
||||||
|
*/
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->requestedRightService = self::$container->get(RequestedRightServiceInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testClassAccessors(): void
|
||||||
|
{
|
||||||
|
$crud = CRUDType::READ;
|
||||||
|
$this->assertNull($this->requestedRightService->setCrud($crud));
|
||||||
|
$this->assertEquals($crud, $this->requestedRightService->getCrud());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tests\Integration\Domain\RequestManagement\Right;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||||
|
use App\Domain\RequestManagement\User\RequestedUserServiceInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
class RequestedUserServiceIntegrationTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var RequestedUserServiceInterface
|
||||||
|
*/
|
||||||
|
private $requestedUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
||||||
|
*/
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->requestedUserService = self::$container->get(RequestedUserServiceInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCrudAccessors(): void
|
||||||
|
{
|
||||||
|
$crud = CRUDType::READ;
|
||||||
|
$this->assertNull($this->requestedUserService->setCrud($crud));
|
||||||
|
$this->assertEquals($crud, $this->requestedUserService->getCrud());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tests\Integration\Domain\UserManagement;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use App\Domain\UserManagement\UserSourceDirectorServiceInterface;
|
||||||
|
use App\Entity\UserInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
class UserSourceDirectorServiceIntegrationTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var UserSourceDirectorServiceInterface
|
||||||
|
*/
|
||||||
|
private $userSourceDirectorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
||||||
|
*/
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->userSourceDirectorService = self::$container->get(UserSourceDirectorServiceInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCrudAccessors(): void
|
||||||
|
{
|
||||||
|
$this->assertInstanceOf(UserInterface::class, $this->userSourceDirectorService->getUser());
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user