In between commit Exception refactoring

This commit is contained in:
Kevin Frantz 2019-04-14 23:37:30 +02:00
parent 679bfd2079
commit 9f179ead73
64 changed files with 256 additions and 241 deletions

View File

@ -2,8 +2,8 @@
namespace Infinito\Attribut;
use Infinito\Exception\NoValidChoiceException;
use Infinito\DBAL\Types\ActionType;
use Infinito\Exception\Type\InvalidChoiceTypeException;
/**
* @author kevinfrantz
@ -19,11 +19,12 @@ trait ActionTypeAttribut
/**
* @param string $actionType
* @throws InvalidChoiceTypeException
*/
public function setActionType(string $actionType): void
{
if (!in_array($actionType, ActionType::getValues())) {
throw new NoValidChoiceException('The type is not a valid action type.');
throw new InvalidChoiceTypeException('The type is not a valid action type.');
}
$this->actionType = $actionType;
}

View File

@ -1,22 +1,25 @@
<?php
namespace Infinito\Attribut;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
*
* @see ClassAttributInterface
*
* @author kevinfrantz
*/
trait ClassAttribut
{
/**
*
* @var string
*/
private $class;
/**
*
* @param string $class
*/
public function setClass(string $class): void
@ -26,10 +29,11 @@ trait ClassAttribut
return;
}
throw new NotFoundHttpException('Class '.$class.' couldn\'t be found!');
throw new NotFoundHttpException('Class ' . $class . ' couldn\'t be found!');
}
/**
*
* @return string
*/
public function getClass(): string
@ -38,6 +42,7 @@ trait ClassAttribut
}
/**
*
* @return bool
*/
public function hasClass(): bool

View File

@ -2,11 +2,12 @@
namespace Infinito\Attribut;
use Infinito\Exception\NoValidChoiceException;
use Infinito\DBAL\Types\Meta\Right\CRUDType;
use Infinito\Exception\Type\InvalidChoiceTypeException;
/**
* @author kevinfrantz
* @see CrudAttributInterface
*/
trait CrudAttribut
{
@ -23,7 +24,7 @@ trait CrudAttribut
public function setCrud(string $crud): void
{
if (!in_array($crud, CRUDType::getValues())) {
throw new NoValidChoiceException();
throw new InvalidChoiceTypeException("Value <<$crud>> is no valid choice!");
}
$this->crud = $crud;
}

View File

@ -3,7 +3,7 @@
namespace Infinito\Attribut;
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Exception\NoValidChoiceException;
use Infinito\Exception\Type\InvalidChoiceTypeException;
/**
* @author kevinfrantz
@ -20,14 +20,14 @@ trait LayerAttribut
protected $layer;
/**
*
* @param string $layer
*
* @throws NoValidChoiceException
* @throws InvalidChoiceTypeException
*/
public function setLayer(string $layer): void
{
if (!in_array($layer, LayerType::getValues())) {
throw new NoValidChoiceException("'$layer' is not a correct layer type.");
throw new InvalidChoiceTypeException("'$layer' is not a correct layer type.");
}
$this->layer = $layer;
}

View File

@ -2,7 +2,7 @@
namespace Infinito\Attribut;
use Infinito\Exception\UnvalidValueException;
use Infinito\Exception\Validation\ValueInvalidException;
/**
* @author kevinfrantz
@ -17,14 +17,15 @@ trait SlugAttribut
protected $slug;
/**
* @todo Maybe throw an other Exception here?
* @param string $slug
*
* @throws UnvalidValueException
*
* @throws ValueInvalidException
*/
public function setSlug(string $slug): void
{
if (is_numeric($slug)) {
throw new UnvalidValueException('A slug must not be numeric!');
throw new ValueInvalidException('A slug must not be numeric!');
}
$this->slug = $slug;
}

View File

@ -2,14 +2,14 @@
namespace Infinito\Domain\DataAccessManagement;
use Doctrine\Common\Collections\Collection;
use Infinito\Exception\AllreadySetException;
use Doctrine\Common\Collections\ArrayCollection;
use Infinito\Exception\NotSetException;
use Infinito\Exception\NoValidChoiceException;
use Doctrine\Common\Collections\Collection;
use Infinito\DBAL\Types\ActionType;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\Entity\EntityInterface;
use Infinito\Exception\Collection\ContainsElementException;
use Infinito\Exception\Collection\NotSetElementException;
use Infinito\Exception\Type\InvalidChoiceTypeException;
use Infinito\Exception\Validation\ValueInvalidException;
use Infinito\Logic\Result\ResultInterface;
use Symfony\Component\Intl\Exception\NotImplementedException;
@ -48,12 +48,11 @@ final class ActionsResultsDAOService extends AbstractActionsDAO implements Actio
/**
* @param string $actionType
*
* @throws NoValidChoiceException
* @throws InvalidChoiceTypeException
*/
private function throwNoValidActionTypeException(string $actionType): void
{
throw new NoValidChoiceException("The action type <<$actionType>> is not defined and not valid!");
throw new InvalidChoiceTypeException("The action type <<$actionType>> is not defined and not valid!");
}
/**
@ -82,36 +81,36 @@ final class ActionsResultsDAOService extends AbstractActionsDAO implements Actio
* @param string $actionType
* @param mixed $data
*
* @throws NotCorrectInstanceException For false a exception is thrown
* @throws ValueInvalidException For false a exception is thrown
*/
private function validateActionData(string $actionType, $data): void
{
if (!$this->isValidActionData($actionType, $data)) {
throw new NotCorrectInstanceException('Data <<'.gettype($data).(is_object($data) ? ':'.get_class($data) : '').">> is not valid for action type <<$actionType>>!");
throw new ValueInvalidException('Data <<'.gettype($data).(is_object($data) ? ':'.get_class($data) : '').">> is not valid for action type <<$actionType>>!");
}
}
/**
* @param string $actionType
*
* @throws NotSetException
* @throws ContainsElementException
*/
private function validateNotSet(string $actionType): void
{
if ($this->isDataStored($actionType)) {
throw new AllreadySetException("Data for <<$actionType>> is allready stored.");
throw new ContainsElementException("Data for <<$actionType>> is allready stored.");
}
}
/**
* @param string $actionType
*
* @throws NotSetException
* @throws NotSetElementException
*/
private function validateSet(string $actionType): void
{
if (!$this->isDataStored($actionType)) {
throw new NotSetException("No data for <<$actionType>> is stored.");
throw new NotSetElementException("No data for <<$actionType>> is stored.");
}
}

View File

@ -6,10 +6,10 @@ use Infinito\Entity\EntityInterface;
use Infinito\Domain\RightManagement\RightTransformerService;
use Doctrine\Common\Collections\Collection;
use Infinito\Domain\RequestManagement\Entity\RequestedEntityServiceInterface;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Domain\LayerManagement\LayerInterfaceMap;
use FOS\UserBundle\Model\UserInterface;
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
/**
* This class is not ready and not tested!
@ -25,12 +25,12 @@ final class EntityDomService implements EntityDomServiceInterface
/**
* @var string
*/
const GET_METHOD = RightTransformerService::GET_PREFIX;
private const GET_METHOD = RightTransformerService::GET_PREFIX;
/**
* @var string
*/
const HAS_METHOD = RightTransformerService::HAS_PREFIX;
private const HAS_METHOD = RightTransformerService::HAS_PREFIX;
/**
* @var RequestedEntityServiceInterface
@ -131,7 +131,7 @@ final class EntityDomService implements EntityDomServiceInterface
}
}
if (is_object($value)) {
throw new NotCorrectInstanceException('The instance '.get_class($value).' is not supported!');
throw new NotCorrectInstanceCoreException('The instance '.get_class($value).' is not supported!');
}
$domElement->setAttribute('type', gettype($value));
$domElement->setAttribute('value', $value);

View File

@ -5,7 +5,7 @@ namespace Infinito\Domain\FormManagement;
use Symfony\Component\Form\FormBuilderInterface;
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
/**
* @author kevinfrantz

View File

@ -4,7 +4,7 @@ namespace Infinito\Domain\LayerManagement;
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Entity\Source\AbstractSource;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Infinito\Entity\Meta\Law;
use Infinito\Entity\Meta\Right;
use Infinito\Entity\Meta\Relation\Parent\HeredityRelation;

View File

@ -4,7 +4,7 @@ namespace Infinito\Domain\ParameterManagement;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Request;
use Infinito\Exception\NotDefinedException;
use Infinito\Exception\Attribut\UndefinedAttributException;
/**
* This class exists out of refactoring reasons.
@ -71,6 +71,6 @@ abstract class AbstractGetParameterService implements GetParameterServiceInterfa
if ($this->hasParameter($key)) {
return $this->currentRequest->get($key);
}
throw new NotDefinedException("The parameter <<$key>> is not defined!");
throw new UndefinedAttributException("The parameter <<$key>> is not defined!");
}
}

View File

@ -3,7 +3,7 @@
namespace Infinito\Domain\ParameterManagement\Parameter;
use Symfony\Component\Validator\Constraints as Assert;
use Infinito\Exception\Validation\InvalidGetParameterException;
use Infinito\Exception\Validation\GetParameterInvalidException;
/**
* @author kevinfrantz
@ -48,6 +48,6 @@ final class FrameParameter extends AbstractParameter
return;
}
}
throw new InvalidGetParameterException("It\'s not possible to set <<$value>> of type <<".$type.'>> for class <<'.get_class().'>>. Just 0 and 1 are allowed!');
throw new GetParameterInvalidException("It\'s not possible to set <<$value>> of type <<".$type.'>> for class <<'.get_class().'>>. Just 0 and 1 are allowed!');
}
}

View File

@ -6,7 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use HaydenPierce\ClassFinder\ClassFinder;
use Infinito\Domain\ParameterManagement\Parameter\ParameterInterface;
use Infinito\Exception\NotDefinedException;
use Infinito\Exception\Collection\NotSetElementException;
/**
* @author kevinfrantz
@ -67,7 +67,7 @@ final class ParameterFactory implements ParameterFactoryInterface
if ($parameter) {
return $parameter;
}
throw new NotDefinedException("The parameter for key <<$key>> doesn't exist! Generate a parameter class in the parameter folder!");
throw new NotSetElementException("The parameter for key <<$key>> doesn't exist! Generate a parameter class in the parameter folder!");
}
/**

View File

@ -4,7 +4,6 @@ namespace Infinito\Domain\ParameterManagement;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Infinito\Exception\Validation\InvalidGetParameterException;
/**
* @author kevinfrantz

View File

@ -6,7 +6,7 @@ use Doctrine\Common\Collections\Collection;
use Infinito\Domain\ReInfinito\Management\RequestedActionStackInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Infinito\Exception\AllreadySetException;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
/**
* @author kevinfrantz

View File

@ -8,16 +8,17 @@ use Infinito\Attribut\SlugAttribut;
use Infinito\Attribut\RequestedRightAttribut;
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
use Infinito\Repository\Source\SourceRepositoryInterface;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\Entity\Source\AbstractSource;
use Infinito\Exception\NotSetException;
use Infinito\Repository\RepositoryInterface;
use Infinito\Entity\Source\SourceInterface;
use Infinito\Attribut\ClassAttribut;
use Infinito\Exception\AllreadyDefinedException;
use Infinito\Domain\RequestManagement\Right\RequestedRightInterface;
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryService;
use Infinito\Exception\EntityNotFoundHttpException;
use Infinito\Exception\Attribut\UndefinedAttributException;
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
use Infinito\Exception\Attribut\AllreadyDefinedAttributException;
use Infinito\Exception\Core\NoIdentityCoreException;
use Infinito\Exception\NotFound\EntityNotFoundException;
/**
* @author kevinfrantz
@ -39,24 +40,24 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
private $layerRepositoryFactoryService;
/**
* @throws NotSetException
* @throws UndefinedAttributException
*/
private function validateHasIdentity(): void
{
if (!($this->hasId() || $this->hasSlug())) {
throw new NotSetException('No identity attribut like id or slug was set!');
throw new NoIdentityCoreException('No identity attribut like id or slug was set!');
}
}
/**
* @param EntityInterface|null $entity
* @param EntityInterface $entity
*
* @throws EntityNotFoundHttpException
* @throws EntityNotFoundException
*/
private function validateLoadedEntity(?EntityInterface $entity): void
{
if (!$entity) {
throw new EntityNotFoundHttpException('Entity with {id:"'.$this->id.'",slug:"'.$this->slug.'"} not found');
throw new EntityNotFoundException('Entity with {id:"'.$this->id.'",slug:"'.$this->slug.'"} not found');
}
}
@ -72,18 +73,13 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
return $this->loadById();
}
/**
* @throws NotCorrectInstanceException
*
* @return SourceInterface|null
*/
private function loadBySlug(): ?SourceInterface
{
$repository = $this->getEntityRepository();
if ($repository instanceof SourceRepositoryInterface) {
return $repository->findOneBySlug($this->slug);
}
throw new NotCorrectInstanceException('To read an entity by slug is just allowed for entitys of type '.AbstractSource::class);
throw new NotCorrectInstanceCoreException('To read an entity by slug is just allowed for entitys of type '.AbstractSource::class);
}
/**
@ -97,12 +93,12 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
}
/**
* @throws NotSetException
* @throws UndefinedAttributException
*/
private function validateLayerRepositoryFactoryService(): void
{
if (!$this->layerRepositoryFactoryService) {
throw new NotSetException('The operation is not possible, because the class '.LayerRepositoryFactoryService::class.' is not injected!');
throw new UndefinedAttributException('The operation is not possible, because the class '.LayerRepositoryFactoryService::class.' is not injected!');
}
}
@ -152,7 +148,7 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
public function setIdentity($identity): void
{
if ($this->hasClass()) {
throw new AllreadyDefinedException('A identity can\'t be set if a class is allready defined!');
throw new AllreadyDefinedAttributException('A identity can\'t be set if a class is allready defined!');
}
if (is_numeric($identity)) {
$this->setId($identity);
@ -172,7 +168,7 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
public function setClass(string $class): void
{
if ($this->hasIdentity()) {
throw new AllreadyDefinedException('A class can\'t be manual defined, if an identity is allready set!');
throw new AllreadyDefinedAttributException('A class can\'t be manual defined, if an identity is allready set!');
}
$this->setClassTrait($class);
}

View File

@ -5,14 +5,14 @@ namespace Infinito\Domain\RequestManagement\Right;
use Infinito\Entity\Source\SourceInterface;
use Infinito\Attribut\LayerAttribut;
use Infinito\Attribut\RecieverAttribut;
use Infinito\Exception\PreconditionFailedException;
use Infinito\Domain\RequestManagement\Entity\RequestedEntityInterface;
use Infinito\Attribut\RequestedEntityAttribut;
use Infinito\Entity\Meta\MetaInterface;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\Domain\RequestManagement\Entity\RequestedEntity;
use Infinito\Attribut\ActionTypeAttribut;
use Infinito\Exception\AllreadySetException;
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
use Infinito\Exception\NoIdentityCoreException;
use Infinito\Exception\Attribut\AllreadyDefinedAttributException;
/**
* @author kevinfrantz
@ -31,7 +31,7 @@ class RequestedRight implements RequestedRightInterface
private $source;
/**
* @throws NotCorrectInstanceException
* @throws NotCorrectInstanceCoreException
*/
private function loadSource(): void
{
@ -46,18 +46,18 @@ class RequestedRight implements RequestedRightInterface
return;
}
throw new NotCorrectInstanceException('The entity instance '.get_class($entity).' can\'t be processed');
throw new NotCorrectInstanceCoreException('The entity instance '.get_class($entity).' can\'t be processed');
}
/**
* @throws PreconditionFailedException If the source has no id or slug
* @throws NoIdentityCoreException If the source has no id or slug
*/
private function validateRequestedEntity(): void
{
if ($this->requestedEntity->hasIdentity()) {
return;
}
throw new PreconditionFailedException(get_class($this->requestedEntity).' needs to have a defined attribut id or slug!');
throw new NoIdentityCoreException(get_class($this->requestedEntity).' needs to have a defined attribut id or slug!');
}
/**
@ -79,7 +79,7 @@ class RequestedRight implements RequestedRightInterface
public function setActionType(string $actionType): void
{
if (isset($this->actionType)) {
throw new AllreadySetException("The action type is allready set! Origine: $this->actionType New: $actionType");
throw new AllreadyDefinedAttributException("The action type is allready set! Origine: $this->actionType New: $actionType");
}
$this->setActionTypeTrait($actionType);
}

View File

@ -14,17 +14,17 @@ final class RightTransformerService implements RightTransformerServiceInterface
/**
* @var string Prefix for setter functions
*/
const SET_PREFIX = 'set';
public const SET_PREFIX = 'set';
/**
* @var string Prefix for getter functions
*/
const GET_PREFIX = 'get';
public const GET_PREFIX = 'get';
/**
* @var string Prefix for has functions
*/
const HAS_PREFIX = 'has';
public const HAS_PREFIX = 'has';
/**
* @param string $method

View File

@ -8,7 +8,7 @@ use Infinito\Exception\AllreadySetException;
use Infinito\Entity\Source\AbstractSource;
use Infinito\Entity\Meta\Law;
use Infinito\Exception\AllreadyDefinedException;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Doctrine\Common\Collections\ArrayCollection;
/**

View File

@ -5,7 +5,7 @@ namespace Infinito\Domain\SourceManagement;
use Infinito\Entity\Meta\RightInterface;
use Infinito\Exception\AllreadySetException;
use Infinito\Exception\AllreadyDefinedException;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
/**
* Allows to add and remove rights of a source.

View File

@ -3,7 +3,7 @@
namespace Infinito\Domain\TwigManagement;
use Infinito\DBAL\Types\ActionType;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
/**
* @author kevinfrantz

View File

@ -2,7 +2,7 @@
namespace Infinito\Domain\TwigManagement;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Infinito\DBAL\Types\Meta\Right\LayerType;
/**

View File

@ -4,20 +4,23 @@ namespace Infinito\Entity\Source\Operation;
use Infinito\Logic\Result\Result;
use Doctrine\ORM\Mapping as ORM;
use Infinito\Exception\NotDefinedException;
use Infinito\Exception\Attribut\UndefinedAttributException;
/**
* @author kevinfrantz
* @ORM\Entity()
*
* @deprecated
*
* @todo move to the logic level!
* @todo check out what can be recycled
*/
class AndOperation extends AbstractOperation implements AndOperationInterface
{
public function process(): void
{
if ($this->operands->isEmpty()) {
throw new NotDefinedException('Operands must be defined!');
throw new UndefinedAttributException('Operands must be defined!');
}
$this->result = new Result();
/*

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Attribut;
/**
* @author kevinfrantz
*/
final class AllreadyDefinedAttributException extends \Exception
{
}

View File

@ -1,7 +0,0 @@
<?php
namespace Infinito\Exception;
final class AllreadyDefinedException extends \Exception
{
}

View File

@ -1,11 +0,0 @@
<?php
namespace Infinito\Exception;
final class NotDefinedException extends \Exception
{
public function __construct($message = null)
{
parent::__construct($message);
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Attribut;
/**
* @author kevinfrantz
*/
final class UndefinedAttributException extends \Exception
{
}

View File

@ -1,9 +0,0 @@
<?php
namespace Infinito\Exception;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
final class AllreadySetException extends ConflictHttpException
{
}

View File

@ -0,0 +1,12 @@
<?php
namespace Infinito\Exception\Collection;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
/**
* @author kevinfrantz
*/
final class ContainsElementException extends ConflictHttpException
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Collection;
/**
* @author kevinfrantz
*/
final class NotPossibleSetElementException extends \Exception
{
}

View File

@ -0,0 +1,12 @@
<?php
namespace Infinito\Exception\Collection;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
/**
* @author kevinfrantz
*/
final class NotSetElementException extends ConflictHttpException
{
}

View File

@ -1,9 +0,0 @@
<?php
namespace Infinito\Exception;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
final class NotSetException extends ConflictHttpException
{
}

View File

@ -1,10 +0,0 @@
<?php
namespace Infinito\Exception;
/**
* @author kevinfrantz
*/
class SetNotPossibleException extends \Exception
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Core;
/**
* @author kevinfrantz
*/
final class NoDefaultClassCoreException extends \Exception
{
}

View File

@ -1,10 +0,0 @@
<?php
namespace Infinito\Exception;
/**
* @author kevinfrantz
*/
final class NoDefaultClassException extends \Exception
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Core;
/**
* @author kevinfrantz
*/
final class NoIdentityCoreException extends \Exception
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Core;
/**
* @author kevinfrantz
*/
final class NotCorrectInstanceCoreException extends \TypeError
{
}

View File

@ -1,7 +0,0 @@
<?php
namespace Infinito\Exception;
class NotCorrectInstanceException extends \TypeError
{
}

View File

@ -1,10 +1,10 @@
<?php
namespace Infinito\Exception;
namespace Infinito\Exception\Deprecated;
/**
*
* @author kevinfrantz
*
* @deprecated
*/
final class NotProcessedException extends \Exception

View File

@ -1,10 +0,0 @@
<?php
namespace Infinito\Exception;
/**
* @author kevinfrantz
*/
final class NoIdentityException extends \Exception
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Infinito\Exception;
namespace Infinito\Exception\NotFound;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Permission;
/**
* @author kevinfrantz
*/
class NoPermissionException extends \Exception
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Permission;
/**
* @author kevinfrantz
*/
final class NoSourcePermissionException extends NoPermissionException
{
}

View File

@ -1,10 +0,0 @@
<?php
namespace Infinito\Exception;
/**
* @author kevinfrantz
*/
class NotSecureException extends \Exception
{
}

View File

@ -1,9 +0,0 @@
<?php
namespace Infinito\Exception;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
final class SourceAccessDeniedException extends AccessDeniedHttpException
{
}

View File

@ -0,0 +1,10 @@
<?php
namespace Infinito\Exception\Type;
/**
* @author kevinfrantz
*/
final class InvalidChoiceTypeException extends \Exception
{
}

View File

@ -1,12 +0,0 @@
<?php
namespace Infinito\Exception;
/**
*
* @author kevinfrantz
*
*/
final class NoValidChoiceException extends \Exception
{
}

View File

@ -5,6 +5,6 @@ namespace Infinito\Exception\Validation;
/**
* @author kevinfrantz
*/
class InvalidParameterException extends \Exception
final class FormInvalidException extends \Exception
{
}

View File

@ -7,6 +7,6 @@ namespace Infinito\Exception\Validation;
*
* @author kevinfrantz
*/
class InvalidGetParameterException extends InvalidParameterException
final class GetParameterInvalidException extends ParameterInvalidException
{
}

View File

@ -5,6 +5,6 @@ namespace Infinito\Exception\Validation;
/**
* @author kevinfrantz
*/
class InvalidByFormException extends \Exception
class ParameterInvalidException extends \Exception
{
}

View File

@ -5,6 +5,6 @@ namespace Infinito\Exception\Validation;
/**
* @author kevinfrantz
*/
class InvalidValueException extends \Exception
final class ValueInvalidException extends \Exception
{
}

View File

@ -1,19 +1,19 @@
<?php
namespace tests\Unit\Domain\TemplateManagement;
namespace tests\Unit\Domain\AccessDataManagement;
use PHPUnit\Framework\TestCase;
use Infinito\Exception\NoValidChoiceException;
use Infinito\Exception\NotSetException;
use Infinito\DBAL\Types\ActionType;
use Infinito\Exception\AllreadySetException;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\Domain\DataAccessManagement\ActionsViewsDAOServiceInterface;
use Infinito\Domain\DataAccessManagement\ActionsResultsDAOService;
use Infinito\Domain\DataAccessManagement\ActionsViewsDAOService;
use Infinito\Entity\EntityInterface;
use Infinito\Logic\Result\ResultInterface;
use Infinito\Domain\FormManagement\RequestedActionFormBuilderServiceInterface;
use Infinito\Exception\Type\InvalidChoiceTypeException;
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
use Infinito\Exception\Collection\NotSetElementException;
use Infinito\Exception\Collection\ContainsElementException;
/**
* @author kevinfrantz
@ -49,13 +49,13 @@ class ActionViewsDAOServiceIntegrationTest extends TestCase
public function testNotValidChoiceSetException(): void
{
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->actionsResultsDAO->setData('1231232N', ' ');
}
public function testNotCorrectInstanceSetException(): void
{
$this->expectException(NotCorrectInstanceException::class);
$this->expectException(NotCorrectInstanceCoreException::class);
$data = new class() {
};
$this->actionsResultsDAO->setData(ActionType::READ, $data);
@ -63,13 +63,13 @@ class ActionViewsDAOServiceIntegrationTest extends TestCase
public function testNotValidChoiceGetException(): void
{
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->actionsViewsDAO->getData('1231232N');
}
public function testNotSetGetException(): void
{
$this->expectException(NotSetException::class);
$this->expectException(NotSetElementException::class);
$this->actionsViewsDAO->getData(ActionType::READ);
}
@ -115,7 +115,7 @@ class ActionViewsDAOServiceIntegrationTest extends TestCase
// $viewDataInterface = $this->getActionTypeViewDataMock($actionType);
// $this->assertInstanceOf($viewDataInterface, $this->actionsViewsDAO->getData($actionType));
}
$this->expectException(AllreadySetException::class);
$this->expectException(ContainsElementException::class);
$this->assertNull($this->actionsResultsDAO->setData($actionType, $resultData));
}
}

View File

@ -4,8 +4,6 @@ namespace tests\Integration\Domain\ParameterManagement;
use Infinito\Domain\ParameterManagement\ParameterFactory;
use Infinito\Domain\ParameterManagement\ValidGetParametersService;
use Infinito\Exception\NotDefinedException;
use Infinito\Exception\UnvalidParameterException;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@ -13,6 +11,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
use Infinito\Domain\ParameterManagement\ValidGetParameterServiceInterface;
use Infinito\Domain\ParameterManagement\Parameter\VersionParameter;
use Infinito\Domain\ParameterManagement\ParameterFactoryInterface;
use Infinito\Exception\Validation\GetParameterInvalidException;
use Infinito\Exception\Collection\NotSetElementException;
/**
* @author kevinfrantz
@ -66,22 +66,22 @@ class ValidGetParameterServiceTest extends KernelTestCase
public function testVersionWrongType(): void
{
$key = VersionParameter::getKey();
$this->currentRequest->query->set($key, 'adasdas');
$this->expectException(UnvalidParameterException::class);
$this->validGetParameterService->getParameter($key);
$versionKey = VersionParameter::getKey();
$this->currentRequest->query->set($versionKey, 'adasdas');
$this->expectException(GetParameterInvalidException::class);
$this->validGetParameterService->getParameter($versionKey);
}
public function testConstructor(): void
{
$this->expectException(NotDefinedException::class);
$this->currentRequest->query->set('asdwgwe', 'adasa');
$this->expectException(GetParameterInvalidException::class);
new ValidGetParametersService($this->requestStack, $this->parameterFactory, $this->validator);
}
public function testSetParameterException(): void
{
$this->expectException(NotDefinedException::class);
$this->expectException(NotSetElementException::class);
$this->validGetParameterService->getParameter(VersionParameter::getKey());
}
}

View File

@ -3,10 +3,10 @@
namespace Tests\Unit\Attribut;
use PHPUnit\Framework\TestCase;
use Infinito\Exception\NoValidChoiceException;
use Infinito\Attribut\ActionTypeAttributInterface;
use Infinito\Attribut\ActionTypeAttribut;
use Infinito\DBAL\Types\ActionType;
use Infinito\Exception\Type\InvalidChoiceTypeException;
/**
* @author kevinfrantz
@ -37,7 +37,7 @@ class ActionTypeAttributTest extends TestCase
$this->assertNull($this->actionTypeAttribut->setActionType($enum));
$this->assertEquals($enum, $this->actionTypeAttribut->getActionType());
}
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->actionTypeAttribut->setActionType('NoneValidType');
}
}

View File

@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase;
use Infinito\Attribut\CrudAttributInterface;
use Infinito\Attribut\CrudAttribut;
use Infinito\DBAL\Types\Meta\Right\CRUDType;
use Infinito\Exception\NoValidChoiceException;
use Infinito\Exception\Type\InvalidChoiceTypeException;
/**
* @author kevinfrantz
@ -37,7 +37,7 @@ class CrudAttributTest extends TestCase
$this->assertNull($this->crudAttribut->setCrud($enum));
$this->assertEquals($enum, $this->crudAttribut->getCrud());
}
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->crudAttribut->setCrud('NoneValidType');
}
}

View File

@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase;
use Infinito\Attribut\LayerAttributInterface;
use Infinito\Attribut\LayerAttribut;
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Exception\NoValidChoiceException;
use Infinito\Exception\Type\InvalidChoiceTypeException;
/**
* @author kevinfrantz
@ -37,7 +37,7 @@ class LayerAttributTest extends TestCase
$this->assertNull($this->layerAttribut->setLayer($enum));
$this->assertEquals($enum, $this->layerAttribut->getLayer());
}
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->layerAttribut->setLayer('NoneValidLayer');
}
}

View File

@ -2,15 +2,15 @@
namespace tests\Integration\Domain\AccessManagement;
use PHPUnit\Framework\TestCase;
use Infinito\Exception\NoValidChoiceException;
use Infinito\Exception\NotSetException;
use Infinito\DBAL\Types\ActionType;
use Infinito\Exception\AllreadySetException;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\Domain\DataAccessManagement\ActionsResultsDAOService;
use Infinito\Entity\EntityInterface;
use Infinito\Logic\Result\ResultInterface;
use PHPUnit\Framework\TestCase;
use Infinito\Exception\Collection\ContainsElementException;
use Infinito\Exception\Collection\NotSetElementException;
use Infinito\Exception\Type\InvalidChoiceTypeException;
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
use Infinito\Domain\DataAccessManagement\ActionsResultsDAOServiceInterface;
/**
@ -35,13 +35,13 @@ class ActionResultsDAOServiceTest extends TestCase
public function testNotValidChoiceSetException(): void
{
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->actionsResultsDAO->setData('1231232N', ' ');
}
public function testNotCorrectInstanceSetException(): void
{
$this->expectException(NotCorrectInstanceException::class);
$this->expectException(NotCorrectInstanceCoreException::class);
$data = new class() {
};
$this->actionsResultsDAO->setData(ActionType::READ, $data);
@ -49,13 +49,13 @@ class ActionResultsDAOServiceTest extends TestCase
public function testNotValidChoiceGetException(): void
{
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->actionsResultsDAO->getData('1231232N');
}
public function testNotSetGetException(): void
{
$this->expectException(NotSetException::class);
$this->expectException(NotSetElementException::class);
$this->actionsResultsDAO->getData(ActionType::READ);
}
@ -82,7 +82,7 @@ class ActionResultsDAOServiceTest extends TestCase
$this->assertTrue($this->actionsResultsDAO->isDataStored($actionType));
$this->assertEquals($resultData, $this->actionsResultsDAO->getData($actionType));
}
$this->expectException(AllreadySetException::class);
$this->expectException(ContainsElementException::class);
$this->assertNull($this->actionsResultsDAO->setData($actionType, $resultData));
}
}

View File

@ -3,7 +3,7 @@
namespace tests\Unit\Domain\FormManagement;
use PHPUnit\Framework\TestCase;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
use Infinito\Domain\FormManagement\RequestedActionFormBuilder;
use Infinito\Domain\FormManagement\FormClassNameServiceInterface;

View File

@ -5,7 +5,7 @@ namespace tests\Unit\Domain\ParameterManagement;
use PHPUnit\Framework\TestCase;
use Infinito\Domain\ParameterManagement\ParameterFactory;
use Infinito\Domain\ParameterManagement\Parameter\VersionParameter;
use Infinito\Exception\NotDefinedException;
use Infinito\Exception\Collection\NotSetElementException;
/**
* @author kevinfrantz
@ -27,7 +27,7 @@ class ParameterFactoryTest extends TestCase
$versionParameter = $parameterFactory->getParameter('version');
$this->assertInstanceOf(VersionParameter::class, $versionParameter);
$this->assertEquals($versionParameter, $parameterFactory->getParameter('version'));
$this->expectException(NotDefinedException::class);
$this->expectException(NotSetElementException::class);
$versionParameter = $parameterFactory->getParameter('blabalbal');
}
}

View File

@ -6,7 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryService;
use Infinito\Repository\RepositoryInterface;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Infinito\Domain\LayerManagement\LayerClassMap;
/**

View File

@ -5,14 +5,14 @@ namespace tests\Unit\Domain\RequestManagement\Entity;
use PHPUnit\Framework\TestCase;
use Infinito\Domain\RequestManagement\Entity\RequestedEntity;
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
use Infinito\Exception\NotSetException;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\Domain\RequestManagement\Right\RequestedRightInterface;
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Repository\RepositoryInterface;
use Infinito\Entity\EntityInterface;
use Infinito\Entity\Source\AbstractSource;
use Infinito\Exception\AllreadyDefinedException;
use Infinito\Exception\Attribut\UndefinedAttributException;
use Infinito\Exception\NoIdentityCoreException;
use Infinito\Exception\Attribut\AllreadyDefinedAttributException;
/**
* @author kevinfrantz
@ -37,7 +37,7 @@ class RequestedEntityTest extends TestCase
{
$layerRepositoryFactoryService = $this->createMock(LayerRepositoryFactoryServiceInterface::class);
$requestedEntity = new RequestedEntity($layerRepositoryFactoryService);
$this->expectException(NotSetException::class);
$this->expectException(UndefinedAttributException::class);
$requestedEntity->getEntity();
}
@ -50,7 +50,7 @@ class RequestedEntityTest extends TestCase
$requestedEntity = new RequestedEntity($layerRepositoryFactoryService);
$requestedEntity->setSlug('abcd');
$requestedEntity->setRequestedRight($requestedRight);
$this->expectException(NotCorrectInstanceException::class);
$this->expectException(NoIdentityCoreException::class);
$requestedEntity->getEntity();
}
@ -69,7 +69,7 @@ class RequestedEntityTest extends TestCase
$entityResult = $requestedEntity->getEntity();
$this->assertEquals($entityMock, $entityResult);
$this->assertEquals(get_class($entityMock), $requestedEntity->getClass());
$this->expectException(AllreadyDefinedException::class);
$this->expectException(AllreadyDefinedAttributException::class);
$requestedEntity->setClass(AbstractSource::class);
}
@ -86,7 +86,7 @@ class RequestedEntityTest extends TestCase
$this->assertNull($requestedEntity->setClass($class));
$this->assertTrue($requestedEntity->hasClass());
$this->assertEquals($class, $requestedEntity->getClass());
$this->expectException(AllreadyDefinedException::class);
$this->expectException(AllreadyDefinedAttributException::class);
$requestedEntity->setIdentity('123343');
}
@ -94,7 +94,7 @@ class RequestedEntityTest extends TestCase
{
$requestedEntity = new RequestedEntity();
$requestedEntity->setSlug('ABABEBA');
$this->expectException(NotSetException::class);
$this->expectException(UndefinedAttributException::class);
$requestedEntity->getEntity();
}
}

View File

@ -10,7 +10,7 @@ use Infinito\Entity\Meta\RightInterface;
use Infinito\Entity\Meta\Right;
use Infinito\Entity\Meta\Law;
use Infinito\Exception\AllreadySetException;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Infinito\Exception\AllreadyDefinedException;
use Infinito\Entity\Source\PureSource;

View File

@ -5,7 +5,7 @@ namespace tests\Unit\Domain\TwigManagement;
use PHPUnit\Framework\TestCase;
use Infinito\Domain\TwigManagement\ActionIconClassMapInterface;
use Infinito\Domain\TwigManagement\ActionIconClassMap;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Infinito\DBAL\Types\ActionType;
/**

View File

@ -3,7 +3,7 @@
namespace tests\Unit\Domain\TwigManagement;
use PHPUnit\Framework\TestCase;
use Infinito\Exception\NotSetException;
use Infinito\Exception\Collection\NotSetException;
use Infinito\Domain\TwigManagement\LayerIconClassMap;
use Infinito\DBAL\Types\Meta\Right\LayerType;

View File

@ -8,8 +8,8 @@ use Infinito\Entity\Meta\RightInterface;
use Infinito\Entity\Meta\Right;
use Infinito\Entity\Meta\Law;
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Exception\NoValidChoiceException;
use Infinito\Entity\Source\AbstractSource;
use Infinito\Exception\Type\InvalidChoiceTypeException;
/**
* @todo Implement reciever test
@ -77,7 +77,7 @@ class RightTest extends TestCase
$this->assertNull($this->right->setActionType($enum));
$this->assertEquals($enum, $this->right->getActionType());
}
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->right->setActionType('NoneValidType');
}
@ -87,7 +87,7 @@ class RightTest extends TestCase
$this->assertNull($this->right->setLayer($choice));
$this->assertEquals($choice, $this->right->getLayer());
}
$this->expectException(NoValidChoiceException::class);
$this->expectException(InvalidChoiceTypeException::class);
$this->right->setLayer('NoneValidLayer');
}