mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Optimized SourceApiController
This commit is contained in:
parent
93606503f6
commit
d99c05908b
@ -45,11 +45,4 @@ abstract class AbstractAPIController extends AbstractController
|
||||
* @return Response
|
||||
*/
|
||||
abstract public function delete(Request $request, $identifier): Response;
|
||||
|
||||
/**
|
||||
* @param Request $request HTTP Method GET with filtering parameters
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
abstract public function list(Request $request): Response;
|
||||
}
|
||||
|
@ -14,34 +14,48 @@ use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @todo Implement!
|
||||
* @see https://symfony.com/blog/new-in-symfony-4-1-prefix-imported-route-names
|
||||
* @see https://symfony.com/blog/new-in-symfony-4-1-internationalized-routing
|
||||
* @Route(
|
||||
* {
|
||||
* "en":"/source/{identity}.{_format}",
|
||||
* "de":"/quelle/{identity}.{_format}",
|
||||
* "eo":"/fonto/{identity}.{_format}",
|
||||
* "es":"/fontanar/{identity}.{_format}",
|
||||
* "nl":"/bron/{identity}.{_format}"
|
||||
* },
|
||||
* defaults={
|
||||
* "identity"="",
|
||||
* "_format"="json"
|
||||
* } ,
|
||||
* name="source_"
|
||||
* )
|
||||
*/
|
||||
class SourceApiController extends AbstractAPIController
|
||||
{
|
||||
/**
|
||||
* @Route("/{_locale}/api/source/{identifier}.{_format}",
|
||||
* defaults={"_format"="json"} ,
|
||||
* @Route(
|
||||
* methods={"GET"}
|
||||
* )
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Controller\API\AbstractAPIController::read()
|
||||
*/
|
||||
public function read(MVCRoutineServiceInterface $mvcRoutineService, RequestedActionServiceInterface $requestedActionService, $identifier): Response
|
||||
public function read(MVCRoutineServiceInterface $mvcRoutineService, RequestedActionServiceInterface $requestedActionService, $identity): Response
|
||||
{
|
||||
$requestedActionService->setActionType(ActionType::READ);
|
||||
$requestedActionService->setLayer(LayerType::SOURCE);
|
||||
$requestedActionService->getRequestedEntity()->setIdentity($identifier);
|
||||
$requestedActionService->getRequestedEntity()->setIdentity($identity);
|
||||
$view = $mvcRoutineService->process();
|
||||
|
||||
return $this->handleView($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/api/source/{identifier}.{_format}",
|
||||
* defaults={"_format"="json"} ,
|
||||
*@Route(
|
||||
* methods={"PUT"}
|
||||
* )
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Controller\API\AbstractAPIController::update()
|
||||
@ -51,21 +65,7 @@ class SourceApiController extends AbstractAPIController
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/api/sources/.{_format}",
|
||||
* defaults={"_format"="json"} ,
|
||||
* methods={"GET"}
|
||||
* )
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Controller\API\AbstractAPIController::list()
|
||||
*/
|
||||
public function list(Request $request): Response
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/api/source/{identifier}.{_format}",
|
||||
* defaults={"_format"="json"} ,
|
||||
* @Route(
|
||||
* methods={"DELETE"}
|
||||
* )
|
||||
* {@inheritdoc}
|
||||
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace tests\Integration\Domain\FixtureManagement;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class ImprintFixtureSourceTest extends KernelTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
public function testImprintSourceReachable(): void
|
||||
{
|
||||
$request = new Request([], [], [], [], [], [
|
||||
'REQUEST_URI' => 'source/imprint.html',
|
||||
]);
|
||||
$request->setMethod(Request::METHOD_GET);
|
||||
$response = static::$kernel->handle($request);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user