Skip to content

Commit

Permalink
fixed drafts related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Oct 25, 2024
1 parent 116ee1c commit d9724fa
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/integration/Core/Repository/ContentServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct;
use Ibexa\Contracts\Core\Repository\Values\Content\DraftList\ContentDraftListItemInterface;
use Ibexa\Contracts\Core\Repository\Values\Content\DraftList\Item\UnauthorizedContentDraftListItem;
use Ibexa\Contracts\Core\Repository\Values\Content\Field;
use Ibexa\Contracts\Core\Repository\Values\Content\Language;
Expand Down Expand Up @@ -2432,13 +2433,14 @@ public function testLoadContentDraftList()
$this->contentService->createContentDraft($demoDesignContentInfo);

// Now $contentDrafts should contain two drafted versions
/** @var ContentDraftListItemInterface[] $draftedVersions */
$draftedVersions = iterator_to_array($this->contentService->loadContentDraftList()->getIterator());

$actual = [
$draftedVersions[0]->status,
$draftedVersions[0]->getContentInfo()->remoteId,
$draftedVersions[1]->status,
$draftedVersions[1]->getContentInfo()->remoteId,
$draftedVersions[0]->getVersionInfo()->status,
$draftedVersions[0]->getVersionInfo()->getContentInfo()->remoteId,
$draftedVersions[1]->getVersionInfo()->status,
$draftedVersions[1]->getVersionInfo()->getContentInfo()->remoteId,
];
sort($actual, SORT_STRING);

Expand Down Expand Up @@ -2476,6 +2478,7 @@ public function testLoadContentDraftsWithFirstParameter()
$this->permissionResolver->setCurrentUserReference($oldCurrentUser);

// Now $contentDrafts for the previous current user and the new user
/** @var ContentDraftListItemInterface[] $newCurrentUserDrafts */
$newCurrentUserDrafts = iterator_to_array($this->contentService->loadContentDraftList($user)->getIterator());
$oldCurrentUserDrafts = iterator_to_array($this->contentService->loadContentDraftList()->getIterator());

Expand All @@ -2487,13 +2490,13 @@ public function testLoadContentDraftsWithFirstParameter()
self::MEDIA_REMOTE_ID,
],
[
$newCurrentUserDrafts[0]->status,
$newCurrentUserDrafts[0]->getContentInfo()->remoteId,
$newCurrentUserDrafts[0]->getVersionInfo()->status,
$newCurrentUserDrafts[0]->getVersionInfo()->getContentInfo()->remoteId,
]
);
self::assertTrue($newCurrentUserDrafts[0]->isDraft());
self::assertFalse($newCurrentUserDrafts[0]->isArchived());
self::assertFalse($newCurrentUserDrafts[0]->isPublished());
self::assertTrue($newCurrentUserDrafts[0]->getVersionInfo()->isDraft());
self::assertFalse($newCurrentUserDrafts[0]->getVersionInfo()->isArchived());
self::assertFalse($newCurrentUserDrafts[0]->getVersionInfo()->isPublished());
}

/**
Expand Down

0 comments on commit d9724fa

Please sign in to comment.