Skip to content

Commit

Permalink
IBX-6738: Fixed content type group deletion when it contains orphaned…
Browse files Browse the repository at this point in the history
… content type drafts (tests)
  • Loading branch information
adamwojs committed Oct 11, 2023
1 parent dcca468 commit a0a8a0b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/integration/Core/Repository/ContentTypeServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,40 @@ public function testDeleteContentTypeGroup()
$this->fail('Content type group not deleted.');
}

public function testDeleteContentTypeGroupWithOrphanedContentTypeDrafts(): void
{
$this->expectException(NotFoundException::class);

$repository = $this->getRepository();

/* BEGIN: Use Case */
$contentTypeService = $repository->getContentTypeService();

$groupCreate = $contentTypeService->newContentTypeGroupCreateStruct(
'new-group'
);
$contentTypeService->createContentTypeGroup($groupCreate);

$group = $contentTypeService->loadContentTypeGroupByIdentifier('new-group');
for ($i = 0; $i < 3; ++$i) {
$contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct('content_type_draft_' . $i);
$contentTypeCreateStruct->mainLanguageCode = 'eng-GB';
$contentTypeCreateStruct->names = [
'eng-GB' => 'content_type_draft_' . $i,
];

$contentTypeService->createContentType($contentTypeCreateStruct, [$group]);
}

$contentTypeService->deleteContentTypeGroup($group);
/* END: Use Case */

// loadContentTypeGroup should throw NotFoundException
$contentTypeService->loadContentTypeGroup($group->id);

$this->fail('Content type group not deleted.');
}

/**
* Test for the newContentTypeCreateStruct() method.
*
Expand Down

0 comments on commit a0a8a0b

Please sign in to comment.