Skip to content

Commit 298bbca

Browse files
authored
MQE-896: Page schema needs to allow empty section
- PageObjectHandler now allows for empty pages.
1 parent ebbe2d1 commit 298bbca

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php

+19
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ public function testGetPageObject()
5151
$this->assertNull($invalidPage);
5252
}
5353

54+
public function testGetEmptyPage()
55+
{
56+
$mockData = [
57+
"testPage1" => [
58+
"url" => "testURL1",
59+
"module" => "testModule1",
60+
"section" => [
61+
],
62+
"area" => "test"
63+
]];
64+
$this->setMockParserOutput($mockData);
65+
66+
// get pages
67+
$page = PageObjectHandler::getInstance()->getObject('testPage1');
68+
69+
// Empty page has been read in and gotten without an exception being thrown.
70+
$this->addToAssertionCount(1);
71+
}
72+
5473
/**
5574
* Function used to set mock for parser return and force init method to run between tests.
5675
*

src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function __construct()
6262
}
6363

6464
$module = $pageData[self::MODULE];
65-
$sectionNames = array_keys($pageData[self::SECTION]);
65+
$sectionNames = array_keys($pageData[self::SECTION] ?? []);
6666
$parameterized = $pageData[self::PARAMETERIZED] ?? false;
6767

6868
$this->pageObjects[$pageName] =

0 commit comments

Comments
 (0)