mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 11:17:58 +00:00 
			
		
		
		
	Finished refactoring of exceptions
This commit is contained in:
		@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user