Finished refactoring of exceptions

This commit is contained in:
Kevin Frantz
2019-04-15 01:37:17 +02:00
parent 9f179ead73
commit 06f69675ac
49 changed files with 159 additions and 135 deletions

View File

@@ -11,9 +11,9 @@ 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;
use Infinito\Exception\Validation\ValueInvalidException;
/**
* @author kevinfrantz
@@ -55,7 +55,7 @@ class ActionViewsDAOServiceIntegrationTest extends TestCase
public function testNotCorrectInstanceSetException(): void
{
$this->expectException(NotCorrectInstanceCoreException::class);
$this->expectException(ValueInvalidException::class);
$data = new class() {
};
$this->actionsResultsDAO->setData(ActionType::READ, $data);

View File

@@ -13,11 +13,12 @@ use Infinito\Domain\ParameterManagement\Parameter\VersionParameter;
use Infinito\Domain\ParameterManagement\ParameterFactoryInterface;
use Infinito\Exception\Validation\GetParameterInvalidException;
use Infinito\Exception\Collection\NotSetElementException;
use Infinito\Exception\Core\NotImplementedCoreException;
/**
* @author kevinfrantz
*/
class ValidGetParameterServiceTest extends KernelTestCase
class ValidGetParameterServiceIntegrationTest extends KernelTestCase
{
/**
* @var Request
@@ -72,10 +73,17 @@ class ValidGetParameterServiceTest extends KernelTestCase
$this->validGetParameterService->getParameter($versionKey);
}
public function testConstructor(): void
public function testConstructorInvalid(): void
{
$this->currentRequest->query->set(VersionParameter::getKey(), 'adasa');
$this->expectException(GetParameterInvalidException::class);
new ValidGetParametersService($this->requestStack, $this->parameterFactory, $this->validator);
}
public function testConstructorNotImplemented(): void
{
$this->currentRequest->query->set('asdwgwe', 'adasa');
$this->expectException(GetParameterInvalidException::class);
$this->expectException(NotImplementedCoreException::class);
new ValidGetParametersService($this->requestStack, $this->parameterFactory, $this->validator);
}

View File

@@ -46,7 +46,7 @@ class SecureRequestedRightCheckerServiceIntegrationTest extends KernelTestCase
$requestedRight->setLayer($layer);
$requestedRight->setReciever($reciever);
$requestedEntity = $this->createMock(RequestedEntityInterface::class);
$requestedEntity->method('hasId')->willReturn(true);
$requestedEntity->method('hasIdentity')->willReturn(true);
$requestedEntity->method('getEntity')->willReturn($source);
$requestedRight->setRequestedEntity($requestedEntity);
$result = $this->secureRequestedRightCheckerService->check($requestedRight);
@@ -72,7 +72,7 @@ class SecureRequestedRightCheckerServiceIntegrationTest extends KernelTestCase
$requestedRight->setLayer($layer);
$requestedRight->setReciever($reciever);
$requestedEntity = $this->createMock(RequestedEntityInterface::class);
$requestedEntity->method('hasId')->willReturn(true);
$requestedEntity->method('hasIdentity')->willReturn(true);
$requestedEntity->method('getEntity')->willReturn($source);
$requestedRight->setRequestedEntity($requestedEntity);
$result = $this->secureRequestedRightCheckerService->check($requestedRight);