Skip to content

Commit

Permalink
MQE-896: Page schema needs to allow empty section
Browse files Browse the repository at this point in the history
- PageObjectHandler now allows for empty pages.
  • Loading branch information
KevinBKozan authored Apr 19, 2018
1 parent ebbe2d1 commit 298bbca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down

0 comments on commit 298bbca

Please sign in to comment.