mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 15:06:51 +01:00
Optimized MVC and implemented function tests for format
This commit is contained in:
parent
522ba1994e
commit
94b84527a8
@ -6,6 +6,8 @@ use Infinito\Entity\Meta\Relation\RelationInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @see RelationAttributInterface
|
||||
*/
|
||||
trait RelationAttribut
|
||||
{
|
||||
@ -14,11 +16,21 @@ trait RelationAttribut
|
||||
*/
|
||||
protected $relation;
|
||||
|
||||
/**
|
||||
* @param RelationInterface $relation
|
||||
*
|
||||
* @see RelationAttributInterface
|
||||
*/
|
||||
public function setRelation(RelationInterface $relation): void
|
||||
{
|
||||
$this->relation = $relation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RelationAttributInterface
|
||||
*
|
||||
* @return RelationInterface
|
||||
*/
|
||||
public function getRelation(): RelationInterface
|
||||
{
|
||||
return $this->relation;
|
||||
|
@ -9,7 +9,13 @@ use Infinito\Entity\Meta\Relation\RelationInterface;
|
||||
*/
|
||||
interface RelationAttributInterface
|
||||
{
|
||||
/**
|
||||
* @param RelationInterface $relation
|
||||
*/
|
||||
public function setRelation(RelationInterface $relation): void;
|
||||
|
||||
/**
|
||||
* @return RelationInterface
|
||||
*/
|
||||
public function getRelation(): RelationInterface;
|
||||
}
|
||||
|
@ -11,14 +11,29 @@ use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
|
||||
*/
|
||||
final class LayerType extends AbstractEnumType
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const HEREDITY = 'heredity';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RIGHT = 'right';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const SOURCE = 'source';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const LAW = 'law';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const MEMBER = 'member';
|
||||
|
||||
const CREATOR = 'creator';
|
||||
|
@ -44,8 +44,10 @@ final class MVCRoutineService implements MVCRoutineServiceInterface
|
||||
*/
|
||||
public function process(): View
|
||||
{
|
||||
$this->processService->process();
|
||||
$data = $this->processService->process();
|
||||
$view = $this->viewBuilder->getView();
|
||||
$view->setData($data);
|
||||
|
||||
return $this->viewBuilder->getView();
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ final class ProcessService implements ProcessServiceInterface
|
||||
*
|
||||
* @see \Infinito\Domain\ProcessManagement\ProcessServiceInterface::process()
|
||||
*/
|
||||
public function process(): void
|
||||
public function process()
|
||||
{
|
||||
if ($this->requestedActionService->hasRequestedEntity() && $this->requestedActionService->getRequestedEntity()->hasIdentity()) {
|
||||
// READ VIEW
|
||||
@ -95,5 +95,7 @@ final class ProcessService implements ProcessServiceInterface
|
||||
->createView();
|
||||
$this->actionTemplateDataStore->setData(ActionType::CREATE, $updateForm);
|
||||
}
|
||||
|
||||
return $this->actionTemplateDataStore;
|
||||
}
|
||||
}
|
||||
|
@ -7,5 +7,8 @@ namespace Infinito\Domain\ProcessManagement;
|
||||
*/
|
||||
interface ProcessServiceInterface
|
||||
{
|
||||
public function process(): void;
|
||||
/**
|
||||
* @todo specify return type
|
||||
*/
|
||||
public function process();
|
||||
}
|
||||
|
@ -10,21 +10,18 @@ use Infinito\Logic\Operation\OperationInterface;
|
||||
use Infinito\Attribut\ConditionAttribut;
|
||||
use Infinito\Attribut\RecieverAttribut;
|
||||
use Infinito\Attribut\LayerAttribut;
|
||||
use Infinito\Attribut\RelationAttribut;
|
||||
use Infinito\Attribut\PriorityAttribut;
|
||||
use Infinito\Entity\Source\SourceInterface;
|
||||
use Infinito\Attribut\ActionTypeAttribut;
|
||||
|
||||
/**
|
||||
* @todo Remove relation attribut!
|
||||
*
|
||||
* @author kevinfrantz
|
||||
* @ORM\Table(name="meta_right")
|
||||
* @ORM\Entity(repositoryClass="Infinito\Repository\Meta\RightRepository")
|
||||
*/
|
||||
class Right extends AbstractMeta implements RightInterface
|
||||
{
|
||||
use ActionTypeAttribut,LawAttribut, RelationAttribut, GrantAttribut,ConditionAttribut,RecieverAttribut,LayerAttribut,PriorityAttribut;
|
||||
use ActionTypeAttribut,LawAttribut, GrantAttribut,ConditionAttribut,RecieverAttribut,LayerAttribut,PriorityAttribut;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Infinito\Entity\Source\AbstractSource",cascade={"persist", "remove"})
|
||||
|
@ -7,13 +7,12 @@ use Infinito\Attribut\RecieverAttributInterface;
|
||||
use Infinito\Attribut\GrantAttributInterface;
|
||||
use Infinito\Attribut\ConditionAttributInterface;
|
||||
use Infinito\Attribut\LayerAttributInterface;
|
||||
use Infinito\Attribut\RelationAttributInterface;
|
||||
use Infinito\Attribut\PriorityAttributInterface;
|
||||
use Infinito\Attribut\ActionTypeAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RightInterface extends ActionTypeAttributInterface, LawAttributInterface, GrantAttributInterface, RecieverAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface, PriorityAttributInterface
|
||||
interface RightInterface extends ActionTypeAttributInterface, LawAttributInterface, GrantAttributInterface, RecieverAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface, PriorityAttributInterface
|
||||
{
|
||||
}
|
||||
|
46
application/symfony/tests/Functional/FormatFunctionTest.php
Normal file
46
application/symfony/tests/Functional/FormatFunctionTest.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Functional;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class FormatFunctionTest extends WebTestCase
|
||||
{
|
||||
public function testHomepage(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE');
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
$this->assertContains('<html', $client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function testHomepageWithHTML(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.html');
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
$this->assertContains('<html', $client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function testHomepageWithJSON(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.json');
|
||||
echo $client->getResponse()->getContent();
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
// $this->assertContains('<html', $client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function testHomepageWithXML(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.xml');
|
||||
echo $client->getResponse()->getContent();
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
// $this->assertContains('<html', $client->getResponse()->getContent());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user