Skip to content

Commit

Permalink
IBX-6738: Applied code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Oct 23, 2023
1 parent 7f51e57 commit 2974c54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/lib/Repository/ContentTypeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 2 additions & 6 deletions tests/integration/Core/Repository/ContentTypeServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 2974c54

Please sign in to comment.