diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php index 62264569a..62e87022d 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php @@ -51,6 +51,25 @@ public function testGetPageObject() $this->assertNull($invalidPage); } + public function testGetEmptyPage() + { + $mockData = [ + "testPage1" => [ + "url" => "testURL1", + "module" => "testModule1", + "section" => [ + ], + "area" => "test" + ]]; + $this->setMockParserOutput($mockData); + + // get pages + $page = PageObjectHandler::getInstance()->getObject('testPage1'); + + // Empty page has been read in and gotten without an exception being thrown. + $this->addToAssertionCount(1); + } + /** * Function used to set mock for parser return and force init method to run between tests. * diff --git a/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php b/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php index 1985af473..0c47ab7c3 100644 --- a/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php +++ b/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php @@ -62,7 +62,7 @@ private function __construct() } $module = $pageData[self::MODULE]; - $sectionNames = array_keys($pageData[self::SECTION]); + $sectionNames = array_keys($pageData[self::SECTION] ?? []); $parameterized = $pageData[self::PARAMETERIZED] ?? false; $this->pageObjects[$pageName] =