diff --git a/interfaces/CustomPagesService.php b/interfaces/CustomPagesService.php index 375b36d6..72813c7b 100644 --- a/interfaces/CustomPagesService.php +++ b/interfaces/CustomPagesService.php @@ -59,7 +59,7 @@ public function getTargets(string $type, ?ContentContainerActiveRecord $containe * @param ContentContainerActiveRecord|null $container * @return Target */ - public function getTargetById($targetId, $type, ContentContainerActiveRecord $container = null): ?Target + public function getTargetById($targetId, $type, ?ContentContainerActiveRecord $container = null): ?Target { $availableTargets = $this->getTargets($type, $container); return array_key_exists($targetId, $availableTargets) ? $availableTargets[$targetId] : null; diff --git a/tests/codeception/unit/InterfaceTest.php b/tests/codeception/unit/InterfaceTest.php index 53af0070..fab23577 100644 --- a/tests/codeception/unit/InterfaceTest.php +++ b/tests/codeception/unit/InterfaceTest.php @@ -218,6 +218,9 @@ public function testContentTypeValidation() public function testAllowedContentType() { $target = $this->service->getTargetById('global', PageType::Page); + + $this->assertEquals(['debug'], $this->service->getTargets(PageType::Page)); + $this->assertFalse($target->isAllowedContentType(TemplateType::ID)); $this->assertTrue($target->isAllowedContentType(MarkdownType::ID)); }