Skip to content

Commit

Permalink
NGSTACK-842 use getcontentinfo method
Browse files Browse the repository at this point in the history
  • Loading branch information
petarjakopec committed Jun 25, 2024
1 parent 2749908 commit 5dd3fe9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions bundle/ScheduledVisibility/Handler/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public function reveal(ContentValue $content): void

public function isHidden(ContentValue $content): bool
{
return $content->contentInfo->isHidden();
return $content->getContentInfo()->isHidden();
}

public function isVisible(ContentValue $content): bool
{
return !$content->contentInfo->isHidden();
return !$content->getContentInfo()->isHidden();
}
}
5 changes: 2 additions & 3 deletions bundle/ScheduledVisibility/Handler/ObjectState.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Netgen\Bundle\IbexaScheduledVisibilityBundle\ScheduledVisibility\Handler;

use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Ibexa\Contracts\Core\Repository\ObjectStateService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\Content\Content;
Expand Down Expand Up @@ -58,7 +57,7 @@ function () use ($content, $objectStateId): void {
$objectStateGroup = $objectState->getObjectStateGroup();

$this->objectStateService->setContentState(
$content->contentInfo,
$content->getContentInfo(),
$objectStateGroup,
$objectState,
);
Expand All @@ -74,7 +73,7 @@ private function getObjectState(Content $content): ObjectStateValue
function () use ($content, $objectStateGroupId): ObjectStateValue {
$objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId);

return $this->objectStateService->getContentState($content->contentInfo, $objectStateGroup);
return $this->objectStateService->getContentState($content->getContentInfo(), $objectStateGroup);
},
);
}
Expand Down
1 change: 0 additions & 1 deletion bundle/ScheduledVisibility/Handler/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Netgen\Bundle\IbexaScheduledVisibilityBundle\ScheduledVisibility\Handler;

use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\SectionService;
use Ibexa\Contracts\Core\Repository\Values\Content\Content;
Expand Down
2 changes: 1 addition & 1 deletion tests/bundle/Integration/ContentAndLocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden)
if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) {
$handler->reveal($content);
}
$content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->getId());
$content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId());
self::assertEquals($handler->isHidden($content), $expectedHidden);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bundle/Integration/ContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden)
if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) {
$handler->reveal($content);
}
$content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->getId());
$content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId());
self::assertEquals($handler->isHidden($content), $expectedHidden);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bundle/Integration/LocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden)
if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) {
$handler->reveal($content);
}
$content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->getId());
$content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId());
self::assertEquals($handler->isHidden($content), $expectedHidden);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/bundle/Integration/ObjectStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden)
if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) {
$handler->reveal($content);
}
$content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->getId());
$content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId());

$objectStateService = $this->getRepository()->getObjectStateService();
$objectStateGroup = $objectStateService->loadObjectStateGroup(2);
$objectState = $this->getRepository()->sudo(
static fn (): \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState => $objectStateService->getContentState($content->contentInfo, $objectStateGroup),
static fn (): \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState => $objectStateService->getContentState($content->getContentInfo(), $objectStateGroup),
);
self::assertEquals($objectState->id, $expectedHidden ? $hiddenObjectState->id : $visibleObjectStateId);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/bundle/Integration/SectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden)
if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) {
$handler->reveal($content);
}
$content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->getId());
self::assertEquals($content->contentInfo->sectionId, $expectedHidden ? $hiddenSection->id : $visibleSectionId);
$content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId());
self::assertEquals($content->getContentInfo()->sectionId, $expectedHidden ? $hiddenSection->id : $visibleSectionId);
}

private function getSectionHandler(int $hiddenSectionId, int $visibleSectionId): Section
Expand Down

0 comments on commit 5dd3fe9

Please sign in to comment.