From 86198ff2dfb658f6f15a08507bee7b7c7cb49d02 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 20 Jan 2019 12:54:56 +0100 Subject: [PATCH] Refactored draft for Request Management --- .../RepositoryFactoryService.php | 36 +++++++++ .../RepositoryFactoryServiceInterface.php | 21 ++++++ application/symfony/src/Domain/README.md | 16 +--- .../Action/RequestedAction.php | 74 +++++++++++++++++++ .../Action/RequestedActionInterface.php | 16 ++++ .../Action/RequestedActionService.php | 19 +++++ .../RequestedActionServiceInterface.php | 12 +++ .../Entity/RequestedEntity.php | 12 +++ .../Entity/RequestedEntityInterface.php | 12 +++ .../Entity/RequestedEntityService.php | 10 +++ .../RequestedEntityServiceInterface.php | 10 +++ .../src/Domain/RequestManagement/README.md | 12 +++ .../RequestManagement/RequestedSource.php | 12 --- .../RequestedSourceInterface.php | 12 --- .../RequestedSourceService.php | 10 --- .../RequestedSourceServiceInterface.php | 10 --- .../RequestedUserRightInterface.php | 12 --- .../RequestedUserRightServiceInterface.php | 10 --- .../{ => Right}/RequestedRight.php | 15 ++-- .../{ => Right}/RequestedRightInterface.php | 7 +- .../{ => Right}/RequestedRightService.php | 2 +- .../RequestedRightServiceInterface.php | 2 +- .../RequestedUser.php} | 14 ++-- .../User/RequestedUserInterface.php | 14 ++++ .../RequestedUserService.php} | 5 +- .../User/RequestedUserServiceInterface.php | 10 +++ .../ViewManagement/AbstractViewBuilder.php | 43 +++++++++++ .../ViewManagement/ViewBuilderInterface.php | 16 ++++ .../symfony/src/Entity/AbstractEntity.php | 19 ++++- .../symfony/src/Entity/EntityInterface.php | 3 +- .../src/Entity/Source/AbstractSource.php | 18 +---- .../src/Entity/Source/SourceInterface.php | 3 +- .../Repository/Source/SourceRepository.php | 14 +++- .../Source/SourceRepositoryInterface.php | 6 +- .../Action/RequestedActionTest.php | 57 ++++++++++++++ .../RequestedUserRightServiceTest.php | 23 ------ .../{ => Right}/RequestedRightTest.php | 24 +++--- .../User/RequestedUserRightServiceTest.php | 23 ++++++ .../{ => User}/RequestedUserRightTest.php | 26 +++---- .../Source/SourceRepositoryTest.php | 6 +- 40 files changed, 490 insertions(+), 176 deletions(-) create mode 100644 application/symfony/src/Domain/CRUDManagement/RepositoryFactoryService.php create mode 100644 application/symfony/src/Domain/CRUDManagement/RepositoryFactoryServiceInterface.php create mode 100644 application/symfony/src/Domain/RequestManagement/Action/RequestedAction.php create mode 100644 application/symfony/src/Domain/RequestManagement/Action/RequestedActionInterface.php create mode 100644 application/symfony/src/Domain/RequestManagement/Action/RequestedActionService.php create mode 100644 application/symfony/src/Domain/RequestManagement/Action/RequestedActionServiceInterface.php create mode 100644 application/symfony/src/Domain/RequestManagement/Entity/RequestedEntity.php create mode 100644 application/symfony/src/Domain/RequestManagement/Entity/RequestedEntityInterface.php create mode 100644 application/symfony/src/Domain/RequestManagement/Entity/RequestedEntityService.php create mode 100644 application/symfony/src/Domain/RequestManagement/Entity/RequestedEntityServiceInterface.php create mode 100644 application/symfony/src/Domain/RequestManagement/README.md delete mode 100644 application/symfony/src/Domain/RequestManagement/RequestedSource.php delete mode 100644 application/symfony/src/Domain/RequestManagement/RequestedSourceInterface.php delete mode 100644 application/symfony/src/Domain/RequestManagement/RequestedSourceService.php delete mode 100644 application/symfony/src/Domain/RequestManagement/RequestedSourceServiceInterface.php delete mode 100644 application/symfony/src/Domain/RequestManagement/RequestedUserRightInterface.php delete mode 100644 application/symfony/src/Domain/RequestManagement/RequestedUserRightServiceInterface.php rename application/symfony/src/Domain/RequestManagement/{ => Right}/RequestedRight.php (80%) rename application/symfony/src/Domain/RequestManagement/{ => Right}/RequestedRightInterface.php (70%) rename application/symfony/src/Domain/RequestManagement/{ => Right}/RequestedRightService.php (75%) rename application/symfony/src/Domain/RequestManagement/{ => Right}/RequestedRightServiceInterface.php (77%) rename application/symfony/src/Domain/RequestManagement/{RequestedUserRight.php => User/RequestedUser.php} (85%) create mode 100644 application/symfony/src/Domain/RequestManagement/User/RequestedUserInterface.php rename application/symfony/src/Domain/RequestManagement/{RequestedUserRightService.php => User/RequestedUserService.php} (70%) create mode 100644 application/symfony/src/Domain/RequestManagement/User/RequestedUserServiceInterface.php create mode 100644 application/symfony/src/Domain/ViewManagement/AbstractViewBuilder.php create mode 100644 application/symfony/src/Domain/ViewManagement/ViewBuilderInterface.php create mode 100644 application/symfony/tests/Unit/Domain/RequestManagement/Action/RequestedActionTest.php delete mode 100644 application/symfony/tests/Unit/Domain/RequestManagement/RequestedUserRightServiceTest.php rename application/symfony/tests/Unit/Domain/RequestManagement/{ => Right}/RequestedRightTest.php (74%) create mode 100644 application/symfony/tests/Unit/Domain/RequestManagement/User/RequestedUserRightServiceTest.php rename application/symfony/tests/Unit/Domain/RequestManagement/{ => User}/RequestedUserRightTest.php (79%) diff --git a/application/symfony/src/Domain/CRUDManagement/RepositoryFactoryService.php b/application/symfony/src/Domain/CRUDManagement/RepositoryFactoryService.php new file mode 100644 index 0000000..fb4c619 --- /dev/null +++ b/application/symfony/src/Domain/CRUDManagement/RepositoryFactoryService.php @@ -0,0 +1,36 @@ +entityManager = $entityManager; + } + + /** + * {@inheritdoc} + * + * @see \App\Domain\CRUDManagement\RepositoryFactoryInterface::getRepository() + */ + public function getRepository(EntityInterface $entity): RepositoryInterface + { + $this->entityManager->getRepository(get_class($entity)); + } +} diff --git a/application/symfony/src/Domain/CRUDManagement/RepositoryFactoryServiceInterface.php b/application/symfony/src/Domain/CRUDManagement/RepositoryFactoryServiceInterface.php new file mode 100644 index 0000000..f92b6a7 --- /dev/null +++ b/application/symfony/src/Domain/CRUDManagement/RepositoryFactoryServiceInterface.php @@ -0,0 +1,21 @@ + CRUDType::READ, + ]; + + /** + * @var RequestedRightInterface + */ + private $requestedRight; + + /** + * @param RequestedRightInterface $requestedRight + */ + public function __construct(RequestedRightInterface $requestedRight) + { + $this->requestedRight = $requestedRight; + } + + /** + * {@inheritdoc} + * + * @see \App\Entity\Attribut\ActionTypeAttributInterface::setActionType() + */ + public function setActionType(string $actionType): void + { + $this->setActionTypeTrait($actionType); + $this->setRequestedRightCrudType($actionType); + } + + /** + * @param string $actionType + */ + private function setRequestedRightCrudType(string $actionType): void + { + $crudType = $this->getCrudType($actionType); + $this->requestedRight->setCrud($crudType); + } + + /** + * @param string $actionType + * + * @return string + */ + private function getCrudType(string $actionType): string + { + if (key_exists($actionType, self::ACTION_CRUD_MAP)) { + return self::ACTION_CRUD_MAP[$actionType]; + } + + return $actionType; + } +} diff --git a/application/symfony/src/Domain/RequestManagement/Action/RequestedActionInterface.php b/application/symfony/src/Domain/RequestManagement/Action/RequestedActionInterface.php new file mode 100644 index 0000000..356b341 --- /dev/null +++ b/application/symfony/src/Domain/RequestManagement/Action/RequestedActionInterface.php @@ -0,0 +1,16 @@ +requestedSource->hasSlug() || $this->requestedSource->hasId()) { return; @@ -63,11 +64,11 @@ class RequestedRight implements RequestedRightInterface * * @see https://en.wikipedia.org/wiki/Lazy_loading * {@inheritdoc} - * @see \App\Domain\RequestManagement\RequestedRightInterface::getSource() + * @see \App\Domain\RequestManagement\Right\RequestedRightInterface::getSource() */ final public function getSource(): SourceInterface { - $this->validateRequestedSource(); + $this->validateRequestedEntity(); $this->loadSource(); $this->validateLoad(); @@ -85,9 +86,9 @@ class RequestedRight implements RequestedRightInterface /** * {@inheritdoc} * - * @see \App\Domain\RequestManagement\RequestedRightInterface::setRequestedSource() + * @see \App\Domain\RequestManagement\Right\RequestedRightInterface::setRequestedEntity() */ - final public function setRequestedSource(RequestedSourceInterface $requestedSource) + final public function setRequestedEntity(RequestedEntityInterface $requestedSource) { $this->requestedSource = $requestedSource; } diff --git a/application/symfony/src/Domain/RequestManagement/RequestedRightInterface.php b/application/symfony/src/Domain/RequestManagement/Right/RequestedRightInterface.php similarity index 70% rename from application/symfony/src/Domain/RequestManagement/RequestedRightInterface.php rename to application/symfony/src/Domain/RequestManagement/Right/RequestedRightInterface.php index 807d1a6..07244ff 100644 --- a/application/symfony/src/Domain/RequestManagement/RequestedRightInterface.php +++ b/application/symfony/src/Domain/RequestManagement/Right/RequestedRightInterface.php @@ -1,11 +1,12 @@ requestedRight->setRequestedSource($requestedSource); + $this->requestedRight->setRequestedEntity($requestedSource); } } diff --git a/application/symfony/src/Domain/RequestManagement/User/RequestedUserInterface.php b/application/symfony/src/Domain/RequestManagement/User/RequestedUserInterface.php new file mode 100644 index 0000000..9952d79 --- /dev/null +++ b/application/symfony/src/Domain/RequestManagement/User/RequestedUserInterface.php @@ -0,0 +1,14 @@ +view = new View(); + $this->requestedUserRight = $requestedUserRight; + $this->secureCrudFactoryService = $secureCrudFactoryService; + } + + /** + * @return View + */ + public function getView(): View + { + $this->secureCrudFactoryService->create($requestedRight); + } +} diff --git a/application/symfony/src/Domain/ViewManagement/ViewBuilderInterface.php b/application/symfony/src/Domain/ViewManagement/ViewBuilderInterface.php new file mode 100644 index 0000000..e87055b --- /dev/null +++ b/application/symfony/src/Domain/ViewManagement/ViewBuilderInterface.php @@ -0,0 +1,16 @@ +version = 0; diff --git a/application/symfony/src/Entity/EntityInterface.php b/application/symfony/src/Entity/EntityInterface.php index 2d66f70..65df144 100644 --- a/application/symfony/src/Entity/EntityInterface.php +++ b/application/symfony/src/Entity/EntityInterface.php @@ -4,10 +4,11 @@ namespace App\Entity; use App\Entity\Attribut\VersionAttributInterface; use App\Entity\Attribut\IdAttributInterface; +use App\Entity\Attribut\SlugAttributInterface; /** * @author kevinfrantz */ -interface EntityInterface extends VersionAttributInterface, IdAttributInterface +interface EntityInterface extends VersionAttributInterface, IdAttributInterface,SlugAttributInterface { } diff --git a/application/symfony/src/Entity/Source/AbstractSource.php b/application/symfony/src/Entity/Source/AbstractSource.php index c283319..7daebde 100644 --- a/application/symfony/src/Entity/Source/AbstractSource.php +++ b/application/symfony/src/Entity/Source/AbstractSource.php @@ -8,7 +8,6 @@ use App\Entity\AbstractEntity; use App\Entity\Attribut\LawAttribut; use App\Entity\Meta\LawInterface; use App\Entity\Meta\Law; -use App\Entity\Attribut\SlugAttribut; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Validator\Constraints as Assert; use App\Entity\Attribut\CreatorRelationAttribut; @@ -49,22 +48,7 @@ use App\Entity\Meta\Relation\Member\MemberRelationInterface; */ abstract class AbstractSource extends AbstractEntity implements SourceInterface { - use LawAttribut,SlugAttribut,CreatorRelationAttribut, MemberRelationAttribut; - - /** - * System slugs should be writen in UPPER CASES - * Slugs which are defined by the user are checked via the assert. - * - * @ORM\Column(type="string",length=30,nullable=true,unique=true) - * @Assert\Regex(pattern="/^[a-z]+$/") - * - * @todo Check out if a plugin can solve this purpose; - * - * @see https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/sluggable.md - * - * @var string - */ - protected $slug; + use LawAttribut,CreatorRelationAttribut, MemberRelationAttribut; /** * @var CreatorRelationInterface diff --git a/application/symfony/src/Entity/Source/SourceInterface.php b/application/symfony/src/Entity/Source/SourceInterface.php index 70fbd4c..92fab9a 100644 --- a/application/symfony/src/Entity/Source/SourceInterface.php +++ b/application/symfony/src/Entity/Source/SourceInterface.php @@ -5,13 +5,12 @@ namespace App\Entity\Source; use App\Entity\Attribut\IdAttributInterface; use App\Entity\EntityInterface; use App\Entity\Attribut\LawAttributInterface; -use App\Entity\Attribut\SlugAttributInterface; use App\Entity\Attribut\CreatorRelationAttributInterface; use App\Entity\Attribut\MemberRelationAttributInterface; /** * @author kevinfrantz */ -interface SourceInterface extends IdAttributInterface, EntityInterface, LawAttributInterface, SlugAttributInterface, CreatorRelationAttributInterface, MemberRelationAttributInterface +interface SourceInterface extends IdAttributInterface, EntityInterface, LawAttributInterface, CreatorRelationAttributInterface, MemberRelationAttributInterface { } diff --git a/application/symfony/src/Repository/Source/SourceRepository.php b/application/symfony/src/Repository/Source/SourceRepository.php index e092da3..a1ca2ba 100644 --- a/application/symfony/src/Repository/Source/SourceRepository.php +++ b/application/symfony/src/Repository/Source/SourceRepository.php @@ -3,7 +3,7 @@ namespace App\Repository\Source; use App\Entity\Source\SourceInterface; -use App\Domain\RequestManagement\RequestedSourceInterface; +use App\Domain\RequestManagement\Entity\RequestedEntityInterface; use App\Repository\AbstractRepository; /** @@ -11,6 +11,11 @@ use App\Repository\AbstractRepository; */ final class SourceRepository extends AbstractRepository implements SourceRepositoryInterface { + /** + * {@inheritdoc} + * + * @see \App\Repository\Source\SourceRepositoryInterface::findOneBySlug() + */ public function findOneBySlug(string $slug): ?SourceInterface { return $this->findOneBy([ @@ -18,7 +23,12 @@ final class SourceRepository extends AbstractRepository implements SourceReposit ]); } - public function findOneByIdOrSlug(RequestedSourceInterface $requestedSource): ?SourceInterface + /** + * {@inheritdoc} + * + * @see \App\Repository\Source\SourceRepositoryInterface::findOneByIdOrSlug() + */ + public function findOneByIdOrSlug(RequestedEntityInterface $requestedSource): ?SourceInterface { if ($requestedSource->hasId()) { return $this->find($requestedSource->getId()); diff --git a/application/symfony/src/Repository/Source/SourceRepositoryInterface.php b/application/symfony/src/Repository/Source/SourceRepositoryInterface.php index 9de642d..e13f007 100644 --- a/application/symfony/src/Repository/Source/SourceRepositoryInterface.php +++ b/application/symfony/src/Repository/Source/SourceRepositoryInterface.php @@ -3,7 +3,7 @@ namespace App\Repository\Source; use App\Entity\Source\SourceInterface; -use App\Domain\RequestManagement\RequestedSourceInterface; +use App\Domain\RequestManagement\Entity\RequestedEntityInterface; use App\Repository\RepositoryInterface; /** @@ -23,9 +23,9 @@ interface SourceRepositoryInterface extends RepositoryInterface /** * Loads a source by id or if not defined, by slug. * - * @param RequestedSourceInterface $requestedSource + * @param RequestedEntityInterface $requestedSource * * @return SourceInterface|null */ - public function findOneByIdOrSlug(RequestedSourceInterface $requestedSource): ?SourceInterface; + public function findOneByIdOrSlug(RequestedEntityInterface $requestedSource): ?SourceInterface; } diff --git a/application/symfony/tests/Unit/Domain/RequestManagement/Action/RequestedActionTest.php b/application/symfony/tests/Unit/Domain/RequestManagement/Action/RequestedActionTest.php new file mode 100644 index 0000000..53336f9 --- /dev/null +++ b/application/symfony/tests/Unit/Domain/RequestManagement/Action/RequestedActionTest.php @@ -0,0 +1,57 @@ +createMock(SourceRepositoryInterface::class); + $this->requestedRight = new RequestedRight($sourceRepository); + $this->action = new RequestedAction($this->requestedRight); + } + + public function testList(): void + { + $list = ActionType::LIST; + $this->action->setActionType($list); + $this->assertEquals($list, $this->action->getActionType()); + $this->assertEquals(CRUDType::READ, $this->requestedRight->getCrud()); + } + + public function testCrud(): void + { + foreach (CRUDType::getChoices() as $crud) { + $this->action->setActionType($crud); + $this->assertEquals($crud, $this->action->getActionType()); + $this->assertEquals($crud, $this->requestedRight->getCrud()); + } + } +} diff --git a/application/symfony/tests/Unit/Domain/RequestManagement/RequestedUserRightServiceTest.php b/application/symfony/tests/Unit/Domain/RequestManagement/RequestedUserRightServiceTest.php deleted file mode 100644 index 6324cf8..0000000 --- a/application/symfony/tests/Unit/Domain/RequestManagement/RequestedUserRightServiceTest.php +++ /dev/null @@ -1,23 +0,0 @@ -createMock(RequestedRightServiceInterface::class); - $userSourceDirectorService = $this->createMock(UserSourceDirectorServiceInterface::class); - $service = new RequestedUserRightService($userSourceDirectorService, $requestedRightService); - $this->assertInstanceOf(RequestedUserRightServiceInterface::class, $service); - } -} diff --git a/application/symfony/tests/Unit/Domain/RequestManagement/RequestedRightTest.php b/application/symfony/tests/Unit/Domain/RequestManagement/Right/RequestedRightTest.php similarity index 74% rename from application/symfony/tests/Unit/Domain/RequestManagement/RequestedRightTest.php rename to application/symfony/tests/Unit/Domain/RequestManagement/Right/RequestedRightTest.php index 78e6e9c..fe5b40c 100644 --- a/application/symfony/tests/Unit/Domain/RequestManagement/RequestedRightTest.php +++ b/application/symfony/tests/Unit/Domain/RequestManagement/Right/RequestedRightTest.php @@ -1,15 +1,15 @@ requestedRight->getLayer()); } - public function testRequestedSourceWithoutAttributes(): void + public function testRequestedEntityWithoutAttributes(): void { - $requestedSource = $this->createMock(RequestedSource::class); - $this->requestedRight->setRequestedSource($requestedSource); + $requestedSource = $this->createMock(RequestedEntity::class); + $this->requestedRight->setRequestedEntity($requestedSource); $this->expectException(PreconditionFailedException::class); $this->requestedRight->getSource(); } public function testKnownSource(): void { - $requestedSource = new RequestedSource(); + $requestedSource = new RequestedEntity(); $requestedSource->setSlug(SystemSlugType::IMPRINT); - $this->requestedRight->setRequestedSource($requestedSource); + $this->requestedRight->setRequestedEntity($requestedSource); $sourceResponse1 = $this->requestedRight->getSource(); $this->assertGreaterThan(0, $sourceResponse1->getId()); $requestedSource->setSlug(''); @@ -67,11 +67,11 @@ class RequestedRightTest extends KernelTestCase public function testEqualsSlug(): void { $slug = SystemSlugType::IMPRINT; - $requestedSource = $this->createMock(RequestedSourceInterface::class); + $requestedSource = $this->createMock(RequestedEntityInterface::class); $requestedSource->method('getSlug')->willReturn($slug); $requestedSource->method('hasSlug')->willReturn(true); $this->assertEquals($slug, $requestedSource->getSlug()); - $this->requestedRight->setRequestedSource($requestedSource); + $this->requestedRight->setRequestedEntity($requestedSource); $responseSource1 = $this->requestedRight->getSource(); $responseSource2 = $this->requestedRight->getSource(); $this->assertEquals($responseSource1, $responseSource2); diff --git a/application/symfony/tests/Unit/Domain/RequestManagement/User/RequestedUserRightServiceTest.php b/application/symfony/tests/Unit/Domain/RequestManagement/User/RequestedUserRightServiceTest.php new file mode 100644 index 0000000..4f295e6 --- /dev/null +++ b/application/symfony/tests/Unit/Domain/RequestManagement/User/RequestedUserRightServiceTest.php @@ -0,0 +1,23 @@ +createMock(RequestedRightServiceInterface::class); + $userSourceDirectorService = $this->createMock(UserSourceDirectorServiceInterface::class); + $service = new RequestedUserService($userSourceDirectorService, $requestedRightService); + $this->assertInstanceOf(RequestedUserServiceInterface::class, $service); + } +} diff --git a/application/symfony/tests/Unit/Domain/RequestManagement/RequestedUserRightTest.php b/application/symfony/tests/Unit/Domain/RequestManagement/User/RequestedUserRightTest.php similarity index 79% rename from application/symfony/tests/Unit/Domain/RequestManagement/RequestedUserRightTest.php rename to application/symfony/tests/Unit/Domain/RequestManagement/User/RequestedUserRightTest.php index 2f2c6d2..90c0ff8 100644 --- a/application/symfony/tests/Unit/Domain/RequestManagement/RequestedUserRightTest.php +++ b/application/symfony/tests/Unit/Domain/RequestManagement/User/RequestedUserRightTest.php @@ -1,19 +1,19 @@ createMock(UserSourceDirectorInterface::class); $requestedRight = $this->createMock(RequestedRightInterface::class); - $requestedUserRightFacade = new RequestedUserRight($userSourceDirector, $requestedRight); + $requestedUserRightFacade = new RequestedUser($userSourceDirector, $requestedRight); $this->assertInstanceOf(RequestedRightInterface::class, $requestedUserRightFacade); } @@ -46,7 +46,7 @@ class RequestedUserRightTest extends TestCase $requestedRight->method('getLayer')->willReturn($layer); $requestedRight->method('getCrud')->willReturn($type); $requestedRight->method('getSource')->willReturn($source); - $requestedUserRightFacade = new RequestedUserRight($userSourceDirector, $requestedRight); + $requestedUserRightFacade = new RequestedUser($userSourceDirector, $requestedRight); $this->assertEquals($layer, $requestedUserRightFacade->getLayer()); $this->assertEquals($type, $requestedUserRightFacade->getCrud()); $this->assertEquals($source, $requestedUserRightFacade->getSource()); @@ -57,21 +57,21 @@ class RequestedUserRightTest extends TestCase { $layer = LayerType::SOURCE; $type = CRUDType::READ; - $requestedSource = $this->createMock(RequestedSourceInterface::class); + $requestedSource = $this->createMock(RequestedEntityInterface::class); $requestedSource->method('getSlug')->willReturn(SystemSlugType::IMPRINT); $requestedSource->method('hasSlug')->willReturn(true); $sourceRepository = $this->createMock(SourceRepositoryInterface::class); $requestedRight = new RequestedRight($sourceRepository); $user = $this->createMock(User::class); $userSourceDirector = new UserSourceDirector($sourceRepository, $user); - $requestedUserRightFacade = new RequestedUserRight($userSourceDirector, $requestedRight); + $requestedUserRightFacade = new RequestedUser($userSourceDirector, $requestedRight); $this->assertNull($requestedUserRightFacade->setLayer($layer)); $this->assertNull($requestedUserRightFacade->setCrud($type)); - $this->assertNull($requestedUserRightFacade->setRequestedSource($requestedSource)); + $this->assertNull($requestedUserRightFacade->setRequestedEntity($requestedSource)); $this->assertEquals($layer, $requestedRight->getLayer()); $this->assertEquals($type, $requestedRight->getCrud()); $this->expectException(NotSetException::class); - $this->assertNotInstanceOf(RequestedSourceInterface::class, $requestedRight->getSource()); + $this->assertNotInstanceOf(RequestedEntityInterface::class, $requestedRight->getSource()); } public function testSetReciever(): void @@ -79,7 +79,7 @@ class RequestedUserRightTest extends TestCase $reciever = $this->createMock(AbstractSource::class); $userSourceDirector = $this->createMock(UserSourceDirectorInterface::class); $requestedRight = $this->createMock(RequestedRightInterface::class); - $requestedUserRightFacade = new RequestedUserRight($userSourceDirector, $requestedRight); + $requestedUserRightFacade = new RequestedUser($userSourceDirector, $requestedRight); $this->expectException(SetNotPossibleException::class); $requestedUserRightFacade->setReciever($reciever); } diff --git a/application/symfony/tests/Unit/Repository/Source/SourceRepositoryTest.php b/application/symfony/tests/Unit/Repository/Source/SourceRepositoryTest.php index 36e2d3f..f4ecf3a 100644 --- a/application/symfony/tests/Unit/Repository/Source/SourceRepositoryTest.php +++ b/application/symfony/tests/Unit/Repository/Source/SourceRepositoryTest.php @@ -5,7 +5,7 @@ namespace tests\Unit\Repository\Source; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use App\Repository\Source\SourceRepositoryInterface; use App\Entity\Source\AbstractSource; -use App\Domain\RequestManagement\RequestedSourceInterface; +use App\Domain\RequestManagement\Entity\RequestedEntityInterface; use App\DBAL\Types\SystemSlugType; use App\Entity\Source\SourceInterface; @@ -30,12 +30,12 @@ class SourceRepositoryTest extends KernelTestCase public function testLoadBySlugOrId(): void { - $requestedSource = $this->createMock(RequestedSourceInterface::class); + $requestedSource = $this->createMock(RequestedEntityInterface::class); $requestedSource->method('hasSlug')->willReturn(true); $requestedSource->method('getSlug')->willReturn(SystemSlugType::IMPRINT); $imprint = $this->sourceRepository->findOneByIdOrSlug($requestedSource); $this->assertInstanceOf(SourceInterface::class, $imprint); - $requestedSource2 = $this->createMock(RequestedSourceInterface::class); + $requestedSource2 = $this->createMock(RequestedEntityInterface::class); $requestedSource2->method('hasId')->willReturn(true); $requestedSource2->method('getId')->willReturn($imprint->getId()); $imprint2 = $this->sourceRepository->findOneByIdOrSlug($requestedSource2);