mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Implemented RequestedEntityServiceIntegrationTest
This commit is contained in:
parent
031bff568a
commit
c0113ecd32
@ -36,7 +36,6 @@ services:
|
||||
App\:
|
||||
resource: '../src/*'
|
||||
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
|
||||
|
||||
# controllers are imported separately to make sure services can be injected
|
||||
# as action arguments even if you don't extend any base controller class
|
||||
App\Controller\:
|
||||
@ -45,3 +44,7 @@ services:
|
||||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
||||
|
||||
# testing configuration
|
||||
App\Domain\RequestManagement\Entity\RequestedEntityService:
|
||||
public: true
|
@ -16,19 +16,19 @@ use App\Domain\FixtureManagement\FixtureSource\ImpressumFixtureSource;
|
||||
*/
|
||||
final class DefaultController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @deprecated Use load via source instead of fixed route
|
||||
*
|
||||
* @todo Optimize function!
|
||||
* @Route("/imprint.{_format}", defaults={"_format"="json"}, name="imprint")
|
||||
*/
|
||||
public function imprint(MVCRoutineServiceInterface $mvcRoutineService, RequestedActionServiceInterface $requestedActionService): Response
|
||||
{
|
||||
$requestedActionService->setActionType(ActionType::READ);
|
||||
$requestedActionService->getRequestedEntity()->setSlug(ImpressumFixtureSource::SLUG);
|
||||
$view = $mvcRoutineService->process();
|
||||
$this->handleView($view);
|
||||
}
|
||||
// /**
|
||||
// * @deprecated Use load via source instead of fixed route
|
||||
// *
|
||||
// * @todo Optimize function!
|
||||
// * @Route("/imprint.{_format}", defaults={"_format"="json"}, name="imprint")
|
||||
// */
|
||||
// public function imprint(MVCRoutineServiceInterface $mvcRoutineService, RequestedActionServiceInterface $requestedActionService): Response
|
||||
// {
|
||||
// // $requestedActionService->setActionType(ActionType::READ);
|
||||
// // $requestedActionService->getRequestedEntity()->setSlug(ImpressumFixtureSource::SLUG);
|
||||
// // $view = $mvcRoutineService->process();
|
||||
// // $this->handleView($view);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @Route("/", name="homepage")
|
||||
|
8
application/symfony/tests/Integration/Domain/README.md
Normal file
8
application/symfony/tests/Integration/Domain/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Domain Unit Tests
|
||||
## Conventions
|
||||
### Service Tests
|
||||
A test for an service:
|
||||
|
||||
- MUST extend KernelTest
|
||||
- MUST test the actual injection
|
||||
- MUST be an integration test
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace tests\Integration\Domain\RequestManagement\Entity;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use App\Domain\RequestManagement\Entity\RequestedEntityServiceInterface;
|
||||
use App\Domain\RequestManagement\Entity\RequestedEntityService;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class RequestedEntityServiceIntegrationTest extends KernelTestCase
|
||||
{
|
||||
/**
|
||||
* @var RequestedEntityServiceInterface
|
||||
*/
|
||||
private $requestedEntityService;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \PHPUnit\Framework\TestCase::setUp()
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->requestedEntityService = self::$container->get(RequestedEntityService::class);
|
||||
}
|
||||
|
||||
public function testClassAccessors(): void
|
||||
{
|
||||
$class = AbstractSource::class;
|
||||
$this->assertNull($this->requestedEntityService->setClass($class));
|
||||
$this->assertEquals($class, $this->requestedEntityService->getClass());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user