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);
|
||||
|
@@ -5,7 +5,7 @@ namespace Tests\Attribut;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Infinito\Attribut\SlugAttributInterface;
|
||||
use Infinito\Attribut\SlugAttribut;
|
||||
use Infinito\Exception\UnvalidValueException;
|
||||
use Infinito\Exception\Validation\ValueInvalidException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -42,7 +42,7 @@ class SlugAttributTest extends TestCase
|
||||
|
||||
public function testNumericSetException(): void
|
||||
{
|
||||
$this->expectException(UnvalidValueException::class);
|
||||
$this->expectException(ValueInvalidException::class);
|
||||
$this->slugAttribut->setSlug('1234');
|
||||
}
|
||||
}
|
||||
|
@@ -10,8 +10,8 @@ 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;
|
||||
use Infinito\Exception\Validation\ValueInvalidException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -41,7 +41,7 @@ class ActionResultsDAOServiceTest extends TestCase
|
||||
|
||||
public function testNotCorrectInstanceSetException(): void
|
||||
{
|
||||
$this->expectException(NotCorrectInstanceCoreException::class);
|
||||
$this->expectException(ValueInvalidException::class);
|
||||
$data = new class() {
|
||||
};
|
||||
$this->actionsResultsDAO->setData(ActionType::READ, $data);
|
||||
|
@@ -7,7 +7,7 @@ use Infinito\Domain\ActionManagement\ActionInterface;
|
||||
use Infinito\Domain\ActionManagement\AbstractAction;
|
||||
use Infinito\Domain\ActionManagement\ActionDependenciesDAOServiceInterface;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Infinito\Exception\NotValidByFormException;
|
||||
use Infinito\Exception\Validation\FormInvalidException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -51,7 +51,7 @@ class AbstractActionTest extends TestCase
|
||||
{
|
||||
$this->action->isSecure = true;
|
||||
$this->action->validByForm = false;
|
||||
$this->expectException(NotValidByFormException::class);
|
||||
$this->expectException(FormInvalidException::class);
|
||||
$this->action->execute();
|
||||
}
|
||||
}
|
||||
|
@@ -7,10 +7,10 @@ use PHPUnit\Framework\TestCase;
|
||||
use Infinito\Domain\ActionManagement\Read\ReadAction;
|
||||
use Infinito\Domain\ActionManagement\ActionDependenciesDAOServiceInterface;
|
||||
use Infinito\Domain\ActionManagement\Read\ReadActionInterface;
|
||||
use Infinito\Exception\NotSecureException;
|
||||
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
|
||||
use Infinito\Domain\RequestManagement\Entity\RequestedEntityInterface;
|
||||
use Infinito\Entity\Source\SourceInterface;
|
||||
use Infinito\Exception\Permission\NoPermissionException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -59,7 +59,7 @@ class ReadSourceActionTest extends TestCase
|
||||
public function testNotSecureException(): void
|
||||
{
|
||||
$this->actionService->method('isRequestedActionSecure')->willReturn(false);
|
||||
$this->expectException(NotSecureException::class);
|
||||
$this->expectException(NoPermissionException::class);
|
||||
$this->sourceReadAction->execute();
|
||||
}
|
||||
|
||||
|
@@ -20,10 +20,10 @@ use Infinito\Attribut\RightsAttributInterface;
|
||||
use Infinito\Entity\EntityInterface;
|
||||
use Infinito\Attribut\VersionAttribut;
|
||||
use Infinito\Attribut\IdAttribut;
|
||||
use Infinito\Exception\NotCorrectInstanceException;
|
||||
use Infinito\Entity\Source\Complex\UserSource;
|
||||
use Infinito\Entity\User;
|
||||
use Infinito\Attribut\UserAttributInterface;
|
||||
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -65,7 +65,7 @@ class EntityDomServiceTest extends TestCase
|
||||
$entity->setTest(new class() {
|
||||
});
|
||||
$this->requestedEntityService->method('getEntity')->willReturn($entity);
|
||||
$this->expectException(NotCorrectInstanceException::class);
|
||||
$this->expectException(NotCorrectInstanceCoreException::class);
|
||||
$this->entityDomService->getDomDocument();
|
||||
}
|
||||
|
||||
|
@@ -3,11 +3,11 @@
|
||||
namespace tests\Unit\Domain\FormManagement;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Infinito\Exception\Collection\NotSetException;
|
||||
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
|
||||
use Infinito\Domain\FormManagement\RequestedActionFormBuilder;
|
||||
use Infinito\Domain\FormManagement\FormClassNameServiceInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Infinito\Exception\Attribut\UndefinedAttributException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -21,7 +21,7 @@ class RequestedActionFormBuilderTest extends TestCase
|
||||
$formFactory = $this->createMock(FormFactoryInterface::class);
|
||||
$formClassNameService = $this->createMock(FormClassNameServiceInterface::class);
|
||||
$requestedActionFormBuilder = new RequestedActionFormBuilder($formFactory, $formClassNameService);
|
||||
$this->expectException(NotSetException::class);
|
||||
$this->expectException(UndefinedAttributException::class);
|
||||
$requestedActionFormBuilder->create($requestedAction);
|
||||
}
|
||||
}
|
||||
|
@@ -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\Collection\NotSetElementException;
|
||||
use Infinito\Exception\Core\NotImplementedCoreException;
|
||||
|
||||
/**
|
||||
* @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(NotSetElementException::class);
|
||||
$this->expectException(NotImplementedCoreException::class);
|
||||
$versionParameter = $parameterFactory->getParameter('blabalbal');
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ namespace tests\Unit\Domain\ParameterManagement;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Infinito\Exception\NotDefinedException;
|
||||
use Infinito\Domain\ParameterManagement\Parameter\VersionParameter;
|
||||
use Infinito\Domain\ParameterManagement\ParameterFactory;
|
||||
use Infinito\Domain\ParameterManagement\ValidGetParametersService;
|
||||
@@ -13,6 +12,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Infinito\Domain\ParameterManagement\ValidGetParameterServiceInterface;
|
||||
use Infinito\Domain\ParameterManagement\Parameter\ViewParameter;
|
||||
use Infinito\DBAL\Types\ActionType;
|
||||
use Infinito\Exception\Collection\NotSetElementException;
|
||||
use Infinito\Exception\Core\NotImplementedCoreException;
|
||||
|
||||
/**
|
||||
* This class is a bit messed up because it is an recycled class of an other unit.
|
||||
@@ -69,13 +70,17 @@ class ValidGetParameterServiceTest extends KernelTestCase
|
||||
$this->assertTrue($this->validGetParameterService->hasParameter($key));
|
||||
$this->assertEquals($value, $this->validGetParameterService->getParameter($key));
|
||||
}
|
||||
$this->expectException(NotDefinedException::class);
|
||||
}
|
||||
|
||||
public function testNotImplementedException(): void
|
||||
{
|
||||
$this->expectException(NotImplementedCoreException::class);
|
||||
$this->validGetParameterService->getParameter('12312312asdas');
|
||||
}
|
||||
|
||||
public function testSetParameterException(): void
|
||||
public function testNotSetParameterException(): void
|
||||
{
|
||||
$this->expectException(NotDefinedException::class);
|
||||
$this->expectException(NotSetElementException::class);
|
||||
$this->validGetParameterService->getParameter(VersionParameter::getKey());
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
|
||||
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryService;
|
||||
use Infinito\Repository\RepositoryInterface;
|
||||
use Infinito\Exception\Collection\NotSetException;
|
||||
use Infinito\Domain\LayerManagement\LayerClassMap;
|
||||
use Infinito\Exception\Collection\NotSetElementException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -32,7 +32,7 @@ class LayerRepositoryFactoryServiceTest extends KernelTestCase
|
||||
$repositoy = $this->layerRepositoryFactoryService->getRepository($layer);
|
||||
$this->assertInstanceOf(RepositoryInterface::class, $repositoy);
|
||||
}
|
||||
$this->expectException(NotSetException::class);
|
||||
$this->expectException(NotSetElementException::class);
|
||||
$repositoy = $this->layerRepositoryFactoryService->getRepository('UnknownLayer');
|
||||
}
|
||||
}
|
||||
|
@@ -11,8 +11,9 @@ use Infinito\Repository\RepositoryInterface;
|
||||
use Infinito\Entity\EntityInterface;
|
||||
use Infinito\Entity\Source\AbstractSource;
|
||||
use Infinito\Exception\Attribut\UndefinedAttributException;
|
||||
use Infinito\Exception\NoIdentityCoreException;
|
||||
use Infinito\Exception\Core\NoIdentityCoreException;
|
||||
use Infinito\Exception\Attribut\AllreadyDefinedAttributException;
|
||||
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -37,7 +38,7 @@ class RequestedEntityTest extends TestCase
|
||||
{
|
||||
$layerRepositoryFactoryService = $this->createMock(LayerRepositoryFactoryServiceInterface::class);
|
||||
$requestedEntity = new RequestedEntity($layerRepositoryFactoryService);
|
||||
$this->expectException(UndefinedAttributException::class);
|
||||
$this->expectException(NoIdentityCoreException::class);
|
||||
$requestedEntity->getEntity();
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ class RequestedEntityTest extends TestCase
|
||||
$requestedEntity = new RequestedEntity($layerRepositoryFactoryService);
|
||||
$requestedEntity->setSlug('abcd');
|
||||
$requestedEntity->setRequestedRight($requestedRight);
|
||||
$this->expectException(NoIdentityCoreException::class);
|
||||
$this->expectException(NotCorrectInstanceCoreException::class);
|
||||
$requestedEntity->getEntity();
|
||||
}
|
||||
|
||||
|
@@ -12,10 +12,10 @@ use Infinito\Domain\UserManagement\UserSourceDirectorInterface;
|
||||
use Infinito\Domain\RequestManagement\Right\RequestedRightInterface;
|
||||
use Infinito\Domain\RequestManagement\Right\RequestedRight;
|
||||
use Infinito\Domain\RequestManagement\Entity\RequestedEntityInterface;
|
||||
use Infinito\Exception\SetNotPossibleException;
|
||||
use Infinito\Entity\Source\SourceInterface;
|
||||
use Infinito\Domain\RequestManagement\Right\AbstractRequestedRightFacade;
|
||||
use Infinito\Domain\FixtureManagement\FixtureSource\ImpressumFixtureSource;
|
||||
use Infinito\Exception\Collection\NotPossibleSetElementException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -88,7 +88,7 @@ class AbstractRequestedRightFacadeTest extends TestCase
|
||||
$userSourceDirector = $this->createMock(UserSourceDirectorInterface::class);
|
||||
$requestedRight = $this->createMock(RequestedRightInterface::class);
|
||||
$requestedUserRightFacade = new RequestedUser($userSourceDirector, $requestedRight);
|
||||
$this->expectException(SetNotPossibleException::class);
|
||||
$this->expectException(NotPossibleSetElementException::class);
|
||||
$requestedUserRightFacade->setReciever($reciever);
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ use Infinito\Domain\RequestManagement\Right\RequestedRight;
|
||||
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||
use Infinito\Domain\RequestManagement\Entity\RequestedEntity;
|
||||
use Infinito\Domain\RequestManagement\Entity\RequestedEntityInterface;
|
||||
use Infinito\Exception\PreconditionFailedException;
|
||||
use Infinito\Entity\Source\PureSource;
|
||||
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
|
||||
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryService;
|
||||
@@ -16,8 +15,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Infinito\Entity\Meta\Law;
|
||||
use Infinito\Entity\Source\SourceInterface;
|
||||
use Infinito\DBAL\Types\ActionType;
|
||||
use Infinito\Exception\AllreadySetException;
|
||||
use Infinito\Domain\FixtureManagement\FixtureSource\ImpressumFixtureSource;
|
||||
use Infinito\Exception\Core\NoIdentityCoreException;
|
||||
use Infinito\Exception\Collection\ContainsElementException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -59,7 +59,7 @@ class RequestedRightTest extends KernelTestCase
|
||||
{
|
||||
$requestedSource = $this->createMock(RequestedEntity::class);
|
||||
$this->requestedRight->setRequestedEntity($requestedSource);
|
||||
$this->expectException(PreconditionFailedException::class);
|
||||
$this->expectException(NoIdentityCoreException::class);
|
||||
$this->requestedRight->getSource();
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ class RequestedRightTest extends KernelTestCase
|
||||
$requestedEntity = $this->createMock(RequestedEntityInterface::class);
|
||||
$requestedEntity->method('getSlug')->willReturn($slug);
|
||||
$requestedEntity->method('hasSlug')->willReturn(true);
|
||||
$requestedEntity->method('hasIdentity')->willReturn(true);
|
||||
$requestedEntity->method('getEntity')->willReturn($requestedEntityEntity);
|
||||
$this->assertEquals($slug, $requestedEntity->getSlug());
|
||||
$this->requestedRight->setRequestedEntity($requestedEntity);
|
||||
@@ -101,6 +102,7 @@ class RequestedRightTest extends KernelTestCase
|
||||
$requestedEntity->method('getSlug')->willReturn($slug);
|
||||
$requestedEntity->method('hasSlug')->willReturn(true);
|
||||
$requestedEntity->method('getEntity')->willReturn($entity);
|
||||
$requestedEntity->method('hasIdentity')->willReturn(true);
|
||||
$this->assertEquals($slug, $requestedEntity->getSlug());
|
||||
$this->requestedRight->setRequestedEntity($requestedEntity);
|
||||
$this->requestedRight->setLayer(LayerType::LAW);
|
||||
@@ -113,7 +115,7 @@ class RequestedRightTest extends KernelTestCase
|
||||
$attributType = ActionType::CREATE;
|
||||
$this->requestedRight->setActionType($attributType);
|
||||
$this->assertEquals($attributType, $this->requestedRight->getActionType());
|
||||
$this->expectException(AllreadySetException::class);
|
||||
$this->expectException(ContainsElementException::class);
|
||||
$this->requestedRight->setActionType($attributType);
|
||||
}
|
||||
}
|
||||
|
@@ -14,9 +14,9 @@ use Infinito\Domain\RequestManagement\Right\RequestedRight;
|
||||
use Infinito\Domain\UserManagement\UserSourceDirector;
|
||||
use Infinito\Repository\Source\SourceRepositoryInterface;
|
||||
use Infinito\Domain\RequestManagement\Entity\RequestedEntityInterface;
|
||||
use Infinito\Exception\SetNotPossibleException;
|
||||
use Infinito\Exception\NotCorrectInstanceException;
|
||||
use Infinito\Domain\FixtureManagement\FixtureSource\ImpressumFixtureSource;
|
||||
use Infinito\Exception\Core\NotCorrectInstanceCoreException;
|
||||
use Infinito\Exception\Collection\NotPossibleSetElementException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -57,9 +57,10 @@ class RequestedUserTest extends TestCase
|
||||
{
|
||||
$layer = LayerType::SOURCE;
|
||||
$type = CRUDType::READ;
|
||||
$requestedSource = $this->createMock(RequestedEntityInterface::class);
|
||||
$requestedSource->method('getSlug')->willReturn(ImpressumFixtureSource::getSlug());
|
||||
$requestedSource->method('hasSlug')->willReturn(true);
|
||||
$requestedEntitySource = $this->createMock(RequestedEntityInterface::class);
|
||||
$requestedEntitySource->method('getSlug')->willReturn(ImpressumFixtureSource::getSlug());
|
||||
$requestedEntitySource->method('hasSlug')->willReturn(true);
|
||||
$requestedEntitySource->method('hasIdentity')->willReturn(true);
|
||||
$sourceRepository = $this->createMock(SourceRepositoryInterface::class);
|
||||
$requestedRight = new RequestedRight();
|
||||
$user = $this->createMock(User::class);
|
||||
@@ -67,10 +68,10 @@ class RequestedUserTest extends TestCase
|
||||
$requestedUserRightFacade = new RequestedUser($userSourceDirector, $requestedRight);
|
||||
$this->assertNull($requestedUserRightFacade->setLayer($layer));
|
||||
$this->assertNull($requestedUserRightFacade->setActionType($type));
|
||||
$this->assertNull($requestedUserRightFacade->setRequestedEntity($requestedSource));
|
||||
$this->assertNull($requestedUserRightFacade->setRequestedEntity($requestedEntitySource));
|
||||
$this->assertEquals($layer, $requestedRight->getLayer());
|
||||
$this->assertEquals($type, $requestedRight->getActionType());
|
||||
$this->expectException(NotCorrectInstanceException::class);
|
||||
$this->expectException(NotCorrectInstanceCoreException::class);
|
||||
$this->assertNotInstanceOf(RequestedEntityInterface::class, $requestedRight->getSource());
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ class RequestedUserTest extends TestCase
|
||||
$userSourceDirector = $this->createMock(UserSourceDirectorInterface::class);
|
||||
$requestedRight = $this->createMock(RequestedRightInterface::class);
|
||||
$requestedUserRightFacade = new RequestedUser($userSourceDirector, $requestedRight);
|
||||
$this->expectException(SetNotPossibleException::class);
|
||||
$this->expectException(NotPossibleSetElementException::class);
|
||||
$requestedUserRightFacade->setReciever($reciever);
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@ class RightTransformerServiceTest extends TestCase
|
||||
$requestedEntity = $this->createMock(RequestedEntityInterface::class);
|
||||
$requestedEntity->method('hasId')->willReturn(123);
|
||||
$requestedEntity->method('getEntity')->willReturn($source);
|
||||
$requestedEntity->method('hasIdentity')->willReturn(true);
|
||||
$requestedEntity->method('hasRequestedRight')->willReturn(true);
|
||||
$requestedRight = new RequestedRight();
|
||||
$requestedRight->setActionType($crud);
|
||||
|
@@ -39,6 +39,7 @@ class SecureRequestedRightCheckerServiceTest extends TestCase
|
||||
$requestedEntity = $this->createMock(RequestedEntityInterface::class);
|
||||
$requestedEntity->method('hasId')->willReturn(true);
|
||||
$requestedEntity->method('getEntity')->willReturn($source);
|
||||
$requestedEntity->method('hasIdentity')->willReturn(true);
|
||||
$requestedRight->setRequestedEntity($requestedEntity);
|
||||
$rightTransformerService = new RightTransformerService();
|
||||
$secureEntityChecker = new SecureRequestedRightCheckerService($rightTransformerService);
|
||||
@@ -67,6 +68,7 @@ class SecureRequestedRightCheckerServiceTest extends TestCase
|
||||
$requestedEntity = $this->createMock(RequestedEntityInterface::class);
|
||||
$requestedEntity->method('hasId')->willReturn(true);
|
||||
$requestedEntity->method('getEntity')->willReturn($source);
|
||||
$requestedEntity->method('hasIdentity')->willReturn(true);
|
||||
$requestedRight->setRequestedEntity($requestedEntity);
|
||||
$rightTransformerService = new RightTransformerService();
|
||||
$secureEntityChecker = new SecureRequestedRightCheckerService($rightTransformerService);
|
||||
|
@@ -12,7 +12,7 @@ use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||
use Infinito\DBAL\Types\Meta\Right\CRUDType;
|
||||
use Infinito\Attribut\SourceAttribut;
|
||||
use Infinito\Attribut\SourceAttributInterface;
|
||||
use Infinito\Exception\SourceAccessDenied;
|
||||
use Infinito\Exception\Permission\NoSourcePermissionException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -80,7 +80,7 @@ class SecureSourceCheckerTest extends TestCase
|
||||
$requestedRight = clone $right;
|
||||
$this->assertTrue($this->securerSourceChecker->hasPermission($requestedRight));
|
||||
$childRight->setActionType(CRUDType::READ);
|
||||
$this->expectException(SourceAccessDenied::class);
|
||||
$this->expectException(NoSourcePermissionException::class);
|
||||
$this->securerSourceChecker->hasPermission($requestedRight);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class SecureSourceCheckerTest extends TestCase
|
||||
$requestedRight = clone $right;
|
||||
$this->assertTrue($this->securerSourceChecker->hasPermission($requestedRight));
|
||||
$childRight->setActionType(CRUDType::READ);
|
||||
$this->expectException(SourceAccessDenied::class);
|
||||
$this->expectException(NoSourcePermissionException::class);
|
||||
$this->securerSourceChecker->hasPermission($requestedRight);
|
||||
}
|
||||
|
||||
|
@@ -9,11 +9,14 @@ use Infinito\Domain\SourceManagement\SourceRightManager;
|
||||
use Infinito\Entity\Meta\RightInterface;
|
||||
use Infinito\Entity\Meta\Right;
|
||||
use Infinito\Entity\Meta\Law;
|
||||
use Infinito\Exception\AllreadySetException;
|
||||
use Infinito\Exception\Collection\NotSetException;
|
||||
use Infinito\Exception\AllreadyDefinedException;
|
||||
use Infinito\Entity\Source\PureSource;
|
||||
use Infinito\Exception\Collection\ContainsElementException;
|
||||
use Infinito\Exception\Attribut\AllreadyDefinedAttributException;
|
||||
use Infinito\Exception\Collection\NotSetElementException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class SourceRightManagerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
@@ -41,27 +44,27 @@ class SourceRightManagerTest extends TestCase
|
||||
public function testLawException(): void
|
||||
{
|
||||
$this->right->setLaw(new Law());
|
||||
$this->expectException(AllreadyDefinedException::class);
|
||||
$this->expectException(AllreadyDefinedAttributException::class);
|
||||
$this->sourceRightManager->addRight($this->right);
|
||||
}
|
||||
|
||||
public function testSourceException(): void
|
||||
{
|
||||
$this->right->setSource(new PureSource());
|
||||
$this->expectException(AllreadyDefinedException::class);
|
||||
$this->expectException(AllreadyDefinedAttributException::class);
|
||||
$this->sourceRightManager->addRight($this->right);
|
||||
}
|
||||
|
||||
public function testNotSetException(): void
|
||||
public function testNotSetElementException(): void
|
||||
{
|
||||
$this->expectException(NotSetException::class);
|
||||
$this->expectException(NotSetElementException::class);
|
||||
$this->sourceRightManager->removeRight($this->right);
|
||||
}
|
||||
|
||||
public function testAllreadSetException(): void
|
||||
{
|
||||
$this->sourceRightManager->addRight($this->right);
|
||||
$this->expectException(AllreadySetException::class);
|
||||
$this->expectException(ContainsElementException::class);
|
||||
$this->sourceRightManager->addRight($this->right);
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@ namespace tests\Unit\Domain\TwigManagement;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Infinito\Domain\TwigManagement\ActionIconClassMapInterface;
|
||||
use Infinito\Domain\TwigManagement\ActionIconClassMap;
|
||||
use Infinito\Exception\Collection\NotSetException;
|
||||
use Infinito\DBAL\Types\ActionType;
|
||||
use Infinito\Exception\Collection\NotSetElementException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -30,7 +30,7 @@ class ActionIconClassMapTest extends TestCase
|
||||
|
||||
public function testException(): void
|
||||
{
|
||||
$this->expectException(NotSetException::class);
|
||||
$this->expectException(NotSetElementException::class);
|
||||
$this->actionIconClassMap->getIconClass('wejfhwhke12');
|
||||
}
|
||||
|
||||
|
@@ -3,9 +3,9 @@
|
||||
namespace tests\Unit\Domain\TwigManagement;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Infinito\Exception\Collection\NotSetException;
|
||||
use Infinito\Domain\TwigManagement\LayerIconClassMap;
|
||||
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||
use Infinito\Exception\Collection\NotSetElementException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -14,7 +14,7 @@ class LayerIconClassMapTest extends TestCase
|
||||
{
|
||||
public function testException(): void
|
||||
{
|
||||
$this->expectException(NotSetException::class);
|
||||
$this->expectException(NotSetElementException::class);
|
||||
$this->assertIsString(LayerIconClassMap::getIconClass('123123V'));
|
||||
}
|
||||
|
||||
|
@@ -10,8 +10,11 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Infinito\Logic\Operation\OperandInterface;
|
||||
use Infinito\Logic\Result\ResultInterface;
|
||||
use Infinito\Logic\Result\Result;
|
||||
use Infinito\Exception\NotProcessedException;
|
||||
use Infinito\Exception\Deprecated\NotProcessedException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class AbstractOperationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
@@ -3,13 +3,13 @@
|
||||
namespace tests\unit\Entity\Source\Operation;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Infinito\Exception\NotDefinedException;
|
||||
use Infinito\Logic\Result\Result;
|
||||
use Infinito\Logic\Operation\OperandInterface;
|
||||
use Infinito\Logic\Result\ResultInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Infinito\Entity\Source\Operation\OperationInterface;
|
||||
use Infinito\Entity\Source\Operation\AndOperation;
|
||||
use Infinito\Exception\Attribut\UndefinedAttributException;
|
||||
|
||||
class AndOperationTest extends TestCase
|
||||
{
|
||||
@@ -25,7 +25,7 @@ class AndOperationTest extends TestCase
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(NotDefinedException::class);
|
||||
$this->expectException(UndefinedAttributException::class);
|
||||
$this->operation->process();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user