mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Finished refactoring of exceptions
This commit is contained in:
@@ -71,7 +71,7 @@ class RestRoutesReachableIntegrationTest extends KernelTestCase
|
||||
]);
|
||||
$request->setMethod($method);
|
||||
$response = static::$kernel->handle($request);
|
||||
$this->assertTrue($this->isResponseValid($response), "Route $url with Method $method sends an 404 response and doesn't throw an EntityNotFoundHttpException!");
|
||||
$this->assertTrue($this->isResponseValid($response), "Route $url with Method $method sends an 404 response and doesn't throw an EntityNotFoundException!");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ class RestRoutesReachableIntegrationTest extends KernelTestCase
|
||||
private function isResponseValid(Response $response): bool
|
||||
{
|
||||
$is404 = 404 === $response->getStatusCode();
|
||||
$isEntityNotFoundHttpException = strpos($response->getContent(), 'EntityNotFoundHttpException');
|
||||
$isEntityNotFoundHttpException = strpos($response->getContent(), 'EntityNotFoundException');
|
||||
|
||||
return !$is404 || $isEntityNotFoundHttpException;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user