mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Applied CS fixer
This commit is contained in:
parent
91c41105c7
commit
6bc95f9729
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\EntityInterface;
|
||||
@ -6,9 +7,7 @@ use FOS\RestBundle\Controller\FOSRestController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
abstract class AbstractEntityController extends FOSRestController
|
||||
{
|
||||
@ -17,11 +16,12 @@ abstract class AbstractEntityController extends FOSRestController
|
||||
*/
|
||||
protected $entityName;
|
||||
|
||||
public function __construct(){
|
||||
public function __construct()
|
||||
{
|
||||
$this->setEntityName();
|
||||
}
|
||||
|
||||
abstract protected function setEntityName():void;
|
||||
abstract protected function setEntityName(): void;
|
||||
|
||||
protected function loadEntityById(int $id): EntityInterface
|
||||
{
|
||||
@ -31,13 +31,14 @@ abstract class AbstractEntityController extends FOSRestController
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('No entity found for id '.$id);
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
protected function redirectToRouteById(string $route, int $id): RedirectResponse
|
||||
{
|
||||
return $this->redirectToRoute($route, [
|
||||
'id' => $id
|
||||
'id' => $id,
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,57 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use App\Entity\Meta\Law;
|
||||
use App\Entity\Meta\LawInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @todo Implement security!
|
||||
*/
|
||||
class LawController extends AbstractEntityController
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/law/{id}.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function show(int $id): Response
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var LawInterface $law
|
||||
* @var LawInterface
|
||||
*/
|
||||
$law = $this->loadEntityById($id);
|
||||
$view = $this->view($law, 200)
|
||||
->setTemplate('law/view/standard.html.twig')
|
||||
->setTemplateVar('law');
|
||||
|
||||
return $this->handleView($view);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/law/{id}/right.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function right(int $id): RedirectResponse
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement function!
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/law/{id}/node.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function node(int $id): RedirectResponse
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement function!
|
||||
*/
|
||||
|
@ -12,6 +12,7 @@ use App\Entity\Meta\Relation;
|
||||
/**
|
||||
* @todo IMPLEMENT SECURITY!
|
||||
* @todo Refactor!
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class NodeController extends AbstractEntityController
|
||||
@ -22,12 +23,13 @@ class NodeController extends AbstractEntityController
|
||||
public function show(Request $request, int $id): Response
|
||||
{
|
||||
/**
|
||||
* @var RelationInterface $node
|
||||
* @var RelationInterface
|
||||
*/
|
||||
$relation = $this->loadEntityById($id);
|
||||
$view = $this->view($relation, 200)
|
||||
->setTemplate('node/view/standard.html.twig')
|
||||
->setTemplateVar('node');
|
||||
|
||||
return $this->handleView($view);
|
||||
}
|
||||
|
||||
@ -37,14 +39,16 @@ class NodeController extends AbstractEntityController
|
||||
public function law(int $id): RedirectResponse
|
||||
{
|
||||
$lawId = $this->loadEntityById($id)->getLaw()->getId();
|
||||
return $this->redirectToRouteById('app_law_show',$lawId);
|
||||
|
||||
return $this->redirectToRouteById('app_law_show', $lawId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/node/{id}/parents.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function parents(int $id):Response{
|
||||
/**
|
||||
public function parents(int $id): Response
|
||||
{
|
||||
/*
|
||||
* @todo Implement
|
||||
*/
|
||||
}
|
||||
@ -52,8 +56,9 @@ class NodeController extends AbstractEntityController
|
||||
/**
|
||||
* @Route("/node/{id}/childs.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function childs(int $id):Response{
|
||||
/**
|
||||
public function childs(int $id): Response
|
||||
{
|
||||
/*
|
||||
* @todo Implement
|
||||
*/
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use App\Entity\Method;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use App\Creator\Factory\Template\Source\SourceTemplateFactory;
|
||||
use FOS\RestBundle\Controller\FOSRestController;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
use App\Creator\Factory\Template\Source\SourceTemplateFormFactory;
|
||||
use App\Creator\Factory\Form\Source\SourceFormFactory;
|
||||
@ -15,16 +14,13 @@ use App\Entity\Source\AbstractSource;
|
||||
use App\Entity\Meta\RelationInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @todo IMPLEMENT SECURITY!
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class SourceController extends AbstractEntityController
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/source/{id}.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function show(Request $request, int $id): Response
|
||||
@ -40,7 +36,6 @@ class SourceController extends AbstractEntityController
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/source/{id}/edit.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function edit(Request $request, int $id): Response
|
||||
@ -54,21 +49,22 @@ class SourceController extends AbstractEntityController
|
||||
}
|
||||
|
||||
return $this->render((new SourceTemplateFormFactory($source, $request))->getTemplatePath(), [
|
||||
'form' => $form->createView()
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Route("/source/{id}/node.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function node(int $id): RedirectResponse
|
||||
{
|
||||
$nodeId = $this->loadNodeById($id)->getId();
|
||||
return $this->redirectToRouteById('app_node_show',$nodeId);
|
||||
|
||||
return $this->redirectToRouteById('app_node_show', $nodeId);
|
||||
}
|
||||
|
||||
private function loadNodeById(int $id):RelationInterface{
|
||||
private function loadNodeById(int $id): RelationInterface
|
||||
{
|
||||
return $this->loadEntityById($id)->getNode();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,8 @@ use Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType;
|
||||
|
||||
/**
|
||||
* Not integrated in the db. Just used for mapping.
|
||||
* May it will be helpfull for tracking ;)
|
||||
* May it will be helpfull for tracking ;).
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class MenuEventType extends AbstractEnumType
|
||||
@ -18,7 +19,8 @@ final class MenuEventType extends AbstractEnumType
|
||||
public const NODE = 'app.menu.subbar.node';
|
||||
|
||||
/**
|
||||
* May this will be used in the future
|
||||
* May this will be used in the future.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $choices = [];
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Attribut\IdAttribut;
|
||||
@ -6,7 +7,6 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Attribut\VersionAttribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
abstract class AbstractEntity implements EntityInterface
|
||||
@ -14,7 +14,6 @@ abstract class AbstractEntity implements EntityInterface
|
||||
use IdAttribut, VersionAttribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\Id()
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")(strategy="AUTO")
|
||||
@ -24,8 +23,8 @@ abstract class AbstractEntity implements EntityInterface
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version @ORM\Column(type="integer")
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $version;
|
||||
|
@ -1,25 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
trait VersionAttribut
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
public function setVersion(int $version):void{
|
||||
public function setVersion(int $version): void
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function getVersion():int{
|
||||
public function getVersion(): int
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
/**
|
||||
* Entities which implement this interface can lock stuff on an optimistic base.
|
||||
*
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/transactions-and-concurrency.html
|
||||
* @see https://en.wikipedia.org/wiki/Optimistic_concurrency_control
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface VersionAttributInterface
|
||||
{
|
||||
/**
|
||||
* Returns the revision version of the entity
|
||||
* Returns the revision version of the entity.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getVersion():int;
|
||||
public function getVersion(): int;
|
||||
|
||||
/**
|
||||
* Sets the revision version of the entity
|
||||
* Sets the revision version of the entity.
|
||||
*
|
||||
* @param int $version
|
||||
*/
|
||||
public function setVersion(int $version):void;
|
||||
public function setVersion(int $version): void;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Attribut\VersionAttributInterface;
|
||||
use App\Entity\Attribut\IdAttributInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface EntityInterface extends VersionAttributInterface, IdAttributInterface
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Meta;
|
||||
|
||||
use App\Entity\AbstractEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
abstract class AbstractMeta extends AbstractEntity implements MetaInterface
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Meta;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@ -7,7 +8,6 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attribut\RelationAttribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
* @ORM\Table(name="meta_law")
|
||||
* @ORM\Entity(repositoryClass="App\Repository\LawRepository")
|
||||
@ -17,7 +17,6 @@ final class Law extends AbstractMeta implements LawInterface
|
||||
use RightsAttribute, RelationAttribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="Right", mappedBy="law", cascade={"persist", "remove"})
|
||||
*
|
||||
* @var ArrayCollection | Right[]
|
||||
@ -36,7 +35,7 @@ final class Law extends AbstractMeta implements LawInterface
|
||||
|
||||
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @var RightInterface
|
||||
*/
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Entity\Meta;
|
||||
|
||||
use App\Entity\Attribut\RightsAttributInterface;
|
||||
use App\Entity\Attribut\RelationAttributInterface;
|
||||
use App\Entity\Method\RelationGrantedInterface;
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Meta;
|
||||
|
||||
use App\Entity\EntityInterface;
|
||||
@ -6,10 +7,9 @@ use App\Entity\EntityInterface;
|
||||
/**
|
||||
* Meta entities contain informations which describe sources.
|
||||
* If you refer from a meta entity to an source be aware to catch infinite loops!
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface MetaInterface extends EntityInterface
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ use App\Entity\Attribut\RelationAttributInterface;
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RecieverGroupInterface extends RelationAttributInterface, RecieverAttributInterface,MetaInterface
|
||||
interface RecieverGroupInterface extends RelationAttributInterface, RecieverAttributInterface, MetaInterface
|
||||
{
|
||||
public function getAllRecievers(): ArrayCollection;
|
||||
}
|
||||
|
@ -16,7 +16,9 @@ use Doctrine\Common\Collections\Collection;
|
||||
* This class represents a relation.
|
||||
* It allows a better right management of the meta informations.
|
||||
* Also it is used to capsel the logic relation to an own logical unit.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @todo rename and refactor this class
|
||||
* @ORM\Table(name="meta_relation")
|
||||
* @ORM\Entity()
|
||||
@ -30,7 +32,8 @@ final class Relation extends AbstractMeta implements RelationInterface
|
||||
ChildsAttribut;
|
||||
|
||||
/**
|
||||
* Parents represent the creators of the relation
|
||||
* Parents represent the creators of the relation.
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="Relation")
|
||||
* @ORM\JoinTable(name="meta_relation_parents",
|
||||
* joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")},
|
||||
@ -42,8 +45,10 @@ final class Relation extends AbstractMeta implements RelationInterface
|
||||
protected $parents;
|
||||
|
||||
/**
|
||||
* Childs represent the by the object produced relations
|
||||
* Childs represent the by the object produced relations.
|
||||
*
|
||||
* @todo Replace this by self referencing
|
||||
*
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html
|
||||
* @ORM\ManyToMany(targetEntity="Relation")
|
||||
* @ORM\JoinTable(name="meta_relation_childs",
|
||||
|
@ -11,6 +11,6 @@ use App\Entity\Attribut\LawAttributInterface;
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RelationInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface, LawAttributInterface,MetaInterface
|
||||
interface RelationInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface, LawAttributInterface, MetaInterface
|
||||
{
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Meta;
|
||||
|
||||
use App\Entity\Attribut\TypeAttributInterface;
|
||||
@ -11,7 +12,6 @@ use App\Entity\Method\RelationGrantedInterface;
|
||||
use App\Entity\Attribut\RelationAttributInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RightInterface extends TypeAttributInterface, LawAttributInterface, RelationGrantedInterface, GrantAttributInterface, RecieverGroupAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface
|
||||
|
@ -11,9 +11,11 @@ interface RelationGrantedInterface
|
||||
{
|
||||
/**
|
||||
* @deprecated Methods shouldn't be used on the entity level
|
||||
*
|
||||
* @param RelationInterface $relation
|
||||
* @param string $layer
|
||||
* @param string $right
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isGranted(RelationInterface $relation, string $layer, string $right): bool;
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@ -15,7 +16,6 @@ use App\Entity\Meta\Law;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html
|
||||
@ -30,7 +30,6 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||
use RelationAttribut,GroupSourcesAttribut, LawAttribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var RelationInterface
|
||||
* @ORM\OneToOne(targetEntity="App\Entity\Meta\Relation",cascade={"persist", "remove"})
|
||||
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
|
||||
@ -39,16 +38,15 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||
protected $relation;
|
||||
|
||||
/**
|
||||
*
|
||||
* @todo Implement that just one table on database level is needed!
|
||||
* @todo Rename table to use the right schema
|
||||
*
|
||||
* @var Collection|GroupSource[]
|
||||
* @ORM\ManyToMany(targetEntity="GroupSource")
|
||||
*/
|
||||
protected $groups;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\OneToOne(targetEntity="Law",cascade={"persist", "remove"})
|
||||
* @ORM\JoinColumn(name="law_id", referencedColumnName="id")
|
||||
*
|
||||
|
@ -1,36 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Entity\Source\GroupSourceInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
trait GroupSourcesAttribut
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var Collection|GroupSourceInterface[]
|
||||
*/
|
||||
protected $groups;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Collection|GroupSourceInterface[]
|
||||
*/
|
||||
public function getGroupSources():Collection{
|
||||
public function getGroupSources(): Collection
|
||||
{
|
||||
return $this->groups;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Collection|GroupSourceInterface[] $groups
|
||||
*/
|
||||
public function setGroupSources(Collection $groups):void{
|
||||
public function setGroupSources(Collection $groups): void
|
||||
{
|
||||
$this->groups = $groups;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Entity\Source\GroupSourceInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface GroupSourcesAttributInterface
|
||||
{
|
||||
/**
|
||||
* @param Collection|GroupSourceInterface[] $groups
|
||||
*/
|
||||
public function setGroupSources(Collection $groups):void;
|
||||
public function setGroupSources(Collection $groups): void;
|
||||
|
||||
/**
|
||||
* @return Collection|GroupSourceInterface[]
|
||||
*/
|
||||
public function getGroupSources():Collection;
|
||||
public function getGroupSources(): Collection;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
trait MembersAttribut
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
protected $members;
|
||||
@ -27,4 +24,3 @@ trait MembersAttribut
|
||||
$this->members = $members;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
* Allows to group other sources in a source
|
||||
* Allows to group other sources in a source.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface MembersAttributInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Collection $members
|
||||
*/
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@ -8,7 +9,6 @@ use App\Entity\Source\Attribut\MembersAttribut;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
* @ORM\Table(name="source_group")
|
||||
* @ORM\Entity
|
||||
@ -18,15 +18,14 @@ final class GroupSource extends AbstractSource implements MembersAttributInterfa
|
||||
use MembersAttribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Collection
|
||||
* @ORM\ManyToMany(targetEntity="AbstractSource")
|
||||
*/
|
||||
protected $members;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->members = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source;
|
||||
|
||||
use App\Entity\Source\Attribut\MembersAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
* @todo Map the not jet mapped functions!
|
||||
*
|
||||
* @todo Map the not jet mapped functions!
|
||||
*/
|
||||
interface GroupSourceInterface extends MembersAttributInterface
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ namespace App\Entity\Source;
|
||||
use App\Entity\Attribut\NameAttribut;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use App\Entity\Source\NameSourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Operation;
|
||||
|
||||
use App\Logic\Result\ResultInterface;
|
||||
@ -9,7 +10,6 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="source_operation")
|
||||
@ -19,7 +19,6 @@ use App\Entity\Source\AbstractSource;
|
||||
*/
|
||||
abstract class AbstractOperation extends AbstractSource implements OperationInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* The result MUST NOT be saved via Doctrine!
|
||||
*
|
||||
@ -28,7 +27,6 @@ abstract class AbstractOperation extends AbstractSource implements OperationInte
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var ArrayCollection|OperandInterface[]
|
||||
*/
|
||||
protected $operands;
|
||||
|
@ -19,12 +19,13 @@ class AndOperation extends AbstractOperation
|
||||
throw new \Exception('Operands must be defined!');
|
||||
}
|
||||
$this->result = new Result();
|
||||
/**
|
||||
/*
|
||||
* @var OperandInterface
|
||||
*/
|
||||
foreach ($this->operands->toArray() as $operand) {
|
||||
if (!$operand->getResult()->getBool()) {
|
||||
$this->result->setAll(false);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source;
|
||||
|
||||
use App\Entity\Attribut\IdAttributInterface;
|
||||
@ -7,7 +8,6 @@ use App\Entity\Source\Attribut\GroupSourcesAttributInterface;
|
||||
use App\Entity\Attribut\LawAttributInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface SourceInterface extends IdAttributInterface, EntityInterface, GroupSourcesAttributInterface, LawAttributInterface
|
||||
|
@ -40,8 +40,8 @@ class User extends BaseUser implements UserInterface
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version @ORM\Column(type="integer")
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $version;
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use FOS\UserBundle\Model\UserInterface as FOSUserInterface;
|
||||
@ -7,9 +8,7 @@ use App\Entity\Attribut\VersionAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface UserInterface extends FOSUserInterface, SourceAttributInterface, VersionAttributInterface
|
||||
{
|
||||
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Event\Menu;
|
||||
|
||||
use Knp\Menu\FactoryInterface;
|
||||
@ -7,9 +8,7 @@ use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class MenuEvent extends Event
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Menu;
|
||||
|
||||
use Knp\Menu\FactoryInterface;
|
||||
@ -10,15 +11,12 @@ use App\DBAL\Types\MenuEventType;
|
||||
|
||||
class Menu
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
private $dispatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var FactoryInterface
|
||||
*/
|
||||
private $factory;
|
||||
@ -48,6 +46,7 @@ class Menu
|
||||
{
|
||||
$menu = $this->createBasicMenuItem();
|
||||
$this->dispatcher->dispatch($type, new MenuEvent($this->factory, $menu, $request));
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
@ -55,8 +54,8 @@ class Menu
|
||||
{
|
||||
return $this->factory->createItem('root', [
|
||||
'childrenAttributes' => [
|
||||
'class' => 'navbar-nav mr-auto'
|
||||
]
|
||||
'class' => 'navbar-nav mr-auto',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class LawRepository extends EntityRepository
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Security;
|
||||
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
@ -9,18 +10,17 @@ use App\DBAL\Types\LayerType;
|
||||
use App\Entity\UserInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @see https://symfony.com/doc/current/security/voters.html
|
||||
*/
|
||||
class SourceVoter extends Voter
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string[] $attribute
|
||||
* @var string[]
|
||||
* @var SourceInterface $subject
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Symfony\Component\Security\Core\Authorization\Voter\Voter::supports()
|
||||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
@ -32,31 +32,35 @@ class SourceVoter extends Voter
|
||||
// return (in_array($right, array_keys(LayerType::getChoices())));
|
||||
//}
|
||||
|
||||
private function checkRight(string $right):bool{
|
||||
return (in_array($right, array_keys(RightType::getChoices())));
|
||||
private function checkRight(string $right): bool
|
||||
{
|
||||
return in_array($right, array_keys(RightType::getChoices()));
|
||||
}
|
||||
|
||||
private function checkInstance($subject):bool{
|
||||
return ($subject instanceof SourceInterface);
|
||||
private function checkInstance($subject): bool
|
||||
{
|
||||
return $subject instanceof SourceInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo add if father, that it should have all rights!
|
||||
*
|
||||
* @param string[] $attribute
|
||||
* @param SourceInterface $subject
|
||||
* @param TokenInterface $token
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Symfony\Component\Security\Core\Authorization\Voter\Voter::voteOnAttribute()
|
||||
*/
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||
{
|
||||
/**
|
||||
* @var UserInterface $user
|
||||
* @var UserInterface
|
||||
*/
|
||||
$user = $token->getUser();
|
||||
|
||||
return $subject->getNode()
|
||||
->getLaw()
|
||||
->isGranted($user->getSource()->getNode(), LayerType::SOURCE, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ use App\Entity\Source\SourceInterface;
|
||||
use App\Entity\User;
|
||||
use App\DBAL\Types\RightType;
|
||||
use App\DBAL\Types\LayerType;
|
||||
use App\Structur\Facade\Security\Source\SourceFacadeInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -15,7 +14,8 @@ use App\Structur\Facade\Security\Source\SourceFacadeInterface;
|
||||
abstract class AbstractSourceFacade implements SourceFacadeInterface
|
||||
{
|
||||
/**
|
||||
* Propably it woul be better to solve this over the constructor
|
||||
* Propably it woul be better to solve this over the constructor.
|
||||
*
|
||||
* @var User
|
||||
*/
|
||||
protected static $facadeUser;
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Structur\Facade\Security\Source;
|
||||
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface SourceFacadeInterface extends SourceInterface
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Structur\Facade\Security\Source;
|
||||
|
||||
use App\Entity\Meta\LawInterface;
|
||||
@ -12,13 +13,12 @@ use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
* @todo check if this layer makes sense
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var UserSourceInterface
|
||||
*/
|
||||
protected $source;
|
||||
@ -45,14 +45,16 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
||||
}
|
||||
|
||||
public function getUser(): UserInterface
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function setUser(UserInterface $user): void
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function getVersion(): int
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
@ -60,7 +62,7 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
||||
|
||||
public function setVersion(int $version): void
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
@ -68,7 +70,7 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
||||
|
||||
public function setSource(SourceInterface $source): void
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
@ -76,7 +78,7 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
||||
|
||||
public function getGroupSources(): Collection
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
@ -84,7 +86,7 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
||||
|
||||
public function getSource(): SourceInterface
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
@ -92,14 +94,15 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
||||
|
||||
public function setGroupSources(Collection $groups): void
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
}
|
||||
|
||||
public function setLaw(LawInterface $law): void
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
@ -107,10 +110,9 @@ class UserSourceFacade extends AbstractSourceFacade implements UserSourceInterfa
|
||||
|
||||
public function getLaw(): LawInterface
|
||||
{
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Subscriber;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
@ -7,9 +8,7 @@ use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
@ -21,7 +20,7 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
||||
const FORMAT_TYPES = [
|
||||
'html',
|
||||
'json',
|
||||
'xml'
|
||||
'xml',
|
||||
];
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
@ -29,40 +28,41 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
protected function generateShowDropdown(ItemInterface $menu, Event $event,string $route): void
|
||||
protected function generateShowDropdown(ItemInterface $menu, Event $event, string $route): void
|
||||
{
|
||||
$dropdown = $menu->addChild($this->trans('show'), [
|
||||
'attributes' => [
|
||||
'icon' => 'fas fa-eye',
|
||||
'dropdown' => 'true'
|
||||
]
|
||||
'dropdown' => 'true',
|
||||
],
|
||||
]);
|
||||
foreach (self::FORMAT_TYPES as $format) {
|
||||
$dropdown->addChild($format, [
|
||||
'route' => $route,
|
||||
'routeParameters' => [
|
||||
'id' => $this->getRequestId($event),
|
||||
'_format' => $format
|
||||
'_format' => $format,
|
||||
],
|
||||
'attributes' => [
|
||||
'icon' => 'fas fa-sign-out-alt',
|
||||
'divider_append' => true
|
||||
]
|
||||
'divider_append' => true,
|
||||
],
|
||||
]);
|
||||
}
|
||||
$dropdown->addChild($this->trans('standard'), [
|
||||
'route' => $route,
|
||||
'routeParameters' => [
|
||||
'id' => $this->getRequestId($event)
|
||||
'id' => $this->getRequestId($event),
|
||||
],
|
||||
'attributes' => [
|
||||
'icon' => 'fas fa-sign-out-alt'
|
||||
]
|
||||
'icon' => 'fas fa-sign-out-alt',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function trans(string $id, array $parameter=[]):string{
|
||||
return $this->translator->trans($id,$parameter);
|
||||
protected function trans(string $id, array $parameter = []): string
|
||||
{
|
||||
return $this->translator->trans($id, $parameter);
|
||||
}
|
||||
|
||||
protected function getRequestId(Event $event): int
|
||||
@ -70,4 +70,3 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
||||
return $event->getRequest()->getCurrentRequest()->attributes->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Subscriber;
|
||||
|
||||
use App\DBAL\Types\MenuEventType;
|
||||
use App\Event\Menu\MenuEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class NodeMenuSubscriber extends AbstractEntityMenuSubscriber
|
||||
{
|
||||
public function onNodeMenuConfigure(MenuEvent $event): void
|
||||
{
|
||||
$menu = $event->getItem();
|
||||
$this->generateShowDropdown($menu, $event,'app_source_show');
|
||||
$this->generateShowDropdown($menu, $event, 'app_source_show');
|
||||
$menu->addChild($this->trans('law'), [
|
||||
'route' => 'app_node_law',
|
||||
'routeParameters' => [
|
||||
@ -47,8 +46,7 @@ class NodeMenuSubscriber extends AbstractEntityMenuSubscriber
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
MenuEventType::NODE => 'onNodeMenuConfigure'
|
||||
MenuEventType::NODE => 'onNodeMenuConfigure',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class SourceMenuSubscriber extends AbstractEntityMenuSubscriber
|
||||
'icon' => 'fas fa-edit',
|
||||
],
|
||||
]);
|
||||
$this->generateShowDropdown($menu, $event,'app_source_show');
|
||||
$this->generateShowDropdown($menu, $event, 'app_source_show');
|
||||
$menu->addChild($this->trans('node'), [
|
||||
'route' => 'app_source_node',
|
||||
'routeParameters' => [
|
||||
|
@ -90,7 +90,7 @@ class UserMenuSubscriber implements EventSubscriberInterface
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
MenuEventType::USER=> 'onUserMenuConfigure',
|
||||
MenuEventType::USER => 'onUserMenuConfigure',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit\Entity\Source;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -10,9 +11,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class AbstractSourceTest extends TestCase
|
||||
{
|
||||
@ -22,29 +21,35 @@ class AbstractSourceTest extends TestCase
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
public function setUp(){
|
||||
$this->source = new class extends \App\Entity\Source\AbstractSource{};
|
||||
public function setUp()
|
||||
{
|
||||
$this->source = new class() extends \App\Entity\Source\AbstractSource {
|
||||
};
|
||||
$this->source->setId(self::ID);
|
||||
}
|
||||
|
||||
public function testId(){
|
||||
$this->assertEquals($this->source->getId(),self::ID);
|
||||
public function testId()
|
||||
{
|
||||
$this->assertEquals($this->source->getId(), self::ID);
|
||||
}
|
||||
|
||||
public function testLaw(){
|
||||
$this->assertInstanceOf(LawInterface::class,$this->source->getLaw());
|
||||
public function testLaw()
|
||||
{
|
||||
$this->assertInstanceOf(LawInterface::class, $this->source->getLaw());
|
||||
}
|
||||
|
||||
public function testRelation(){
|
||||
$this->assertInstanceOf(RelationInterface::class,$this->source->getRelation());
|
||||
public function testRelation()
|
||||
{
|
||||
$this->assertInstanceOf(RelationInterface::class, $this->source->getRelation());
|
||||
}
|
||||
|
||||
public function testGroups(){
|
||||
$this->assertInstanceOf(Collection::class,$this->source->getGroupSources());
|
||||
$group = new class extends AbstractSource{};
|
||||
public function testGroups()
|
||||
{
|
||||
$this->assertInstanceOf(Collection::class, $this->source->getGroupSources());
|
||||
$group = new class() extends AbstractSource {
|
||||
};
|
||||
$groups = new ArrayCollection([$group]);
|
||||
$this->source->setGroupSources($groups);
|
||||
$this->assertEquals($group, $this->source->getGroupSources()->get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit\Entity\Source;
|
||||
|
||||
use App\Entity\Source\GroupSourceInterface;
|
||||
@ -9,27 +10,26 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class GroupSourceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var GroupSourceInterface
|
||||
*/
|
||||
protected $groupSource;
|
||||
|
||||
public function setUp():void {
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->groupSource = new GroupSource();
|
||||
}
|
||||
|
||||
public function testMembers(){
|
||||
public function testMembers()
|
||||
{
|
||||
$this->assertInstanceOf(Collection::class, $this->groupSource->getMembers());
|
||||
$member = new class extends AbstractSource{};
|
||||
$member = new class() extends AbstractSource {
|
||||
};
|
||||
$this->groupSource->setMembers(new ArrayCollection([$member]));
|
||||
$this->assertEquals($member, $this->groupSource->getMembers()->get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit\Entity\Source;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -6,15 +7,11 @@ use App\Entity\Source\NameSourceInterface;
|
||||
use App\Entity\Source\NameSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class NameSourceTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var NameSourceInterface
|
||||
*/
|
||||
protected $nameSource;
|
||||
@ -24,11 +21,11 @@ class NameSourceTest extends TestCase
|
||||
$this->nameSource = new NameSource();
|
||||
}
|
||||
|
||||
public function testName():void{
|
||||
public function testName(): void
|
||||
{
|
||||
$this->assertEquals('', $this->nameSource->getName());
|
||||
$name = 'Hello World!';
|
||||
$this->nameSource->setName($name);
|
||||
$this->assertEquals($name, $this->nameSource->getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,10 @@ class UserTest extends TestCase
|
||||
$this->user = new User();
|
||||
$this->user->setUsername(self::USERNAME);
|
||||
$this->user->setPassword(self::PASSWORD);
|
||||
|
||||
}
|
||||
|
||||
public function testConstructor():void{
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->assertInstanceOf(UserInterface::class, new User());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user