From 2974c54fc74840b2044ee252f2d2ee9b2b6d0df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Sun, 15 Oct 2023 11:24:51 +0200 Subject: [PATCH] IBX-6738: Applied code review suggestions --- src/lib/Repository/ContentTypeService.php | 4 ++-- .../Core/Repository/ContentTypeServiceTest.php | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lib/Repository/ContentTypeService.php b/src/lib/Repository/ContentTypeService.php index 8590542653..63ee29092c 100644 --- a/src/lib/Repository/ContentTypeService.php +++ b/src/lib/Repository/ContentTypeService.php @@ -297,8 +297,8 @@ public function deleteContentTypeGroup(APIContentTypeGroup $contentTypeGroup): v $this->repository->beginTransaction(); try { - $ContentTypesDrafts = $this->contentTypeHandler->loadContentTypes($contentTypeGroup->id, SPIContentType::STATUS_DRAFT); - foreach ($ContentTypesDrafts as $contentTypeDraft) { + $contentTypesDrafts = $this->contentTypeHandler->loadContentTypes($contentTypeGroup->id, SPIContentType::STATUS_DRAFT); + foreach ($contentTypesDrafts as $contentTypeDraft) { $this->contentTypeHandler->delete($contentTypeDraft->id, SPIContentType::STATUS_DRAFT); } diff --git a/tests/integration/Core/Repository/ContentTypeServiceTest.php b/tests/integration/Core/Repository/ContentTypeServiceTest.php index d5b1a16f51..476cfdaf4c 100644 --- a/tests/integration/Core/Repository/ContentTypeServiceTest.php +++ b/tests/integration/Core/Repository/ContentTypeServiceTest.php @@ -602,11 +602,8 @@ public function testDeleteContentTypeGroup() public function testDeleteContentTypeGroupWithOrphanedContentTypeDrafts(): void { - $this->expectException(NotFoundException::class); - $repository = $this->getRepository(); - /* BEGIN: Use Case */ $contentTypeService = $repository->getContentTypeService(); $groupCreate = $contentTypeService->newContentTypeGroupCreateStruct( @@ -626,12 +623,11 @@ public function testDeleteContentTypeGroupWithOrphanedContentTypeDrafts(): void } $contentTypeService->deleteContentTypeGroup($group); - /* END: Use Case */ // loadContentTypeGroup should throw NotFoundException - $contentTypeService->loadContentTypeGroup($group->id); + $this->expectException(NotFoundException::class); - $this->fail('Content type group not deleted.'); + $contentTypeService->loadContentTypeGroup($group->id); } /**