Skip to content

Commit e06c188

Browse files
committed
Amend PHPUnit tests and Static tests
1 parent d210dcd commit e06c188

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function testResolveUrl()
227227
}
228228

229229
/**
230-
* {{PageObject}} should not be replaced and should elicit a warning in console
230+
* {{PageObject}} should not be replaced and should throw an exception!
231231
*
232232
* @throws /Exception
233233
*/
@@ -248,18 +248,9 @@ public function testResolveUrlWithNoAttribute()
248248
// Call the method under test
249249
$actionObject->resolveReferences();
250250

251-
// Expect this warning to get generated
252-
TestLoggingUtil::getInstance()->validateMockLogStatement(
253-
"warning",
254-
"page url attribute not found and is required",
255-
['action' => $actionObject->getType(), 'url' => '{{PageObject}}', 'stepKey' => $actionObject->getStepKey()]
256-
);
251+
$this->expectExceptionMessage('Can not resolve replacements: "{{PageObject}}"');
257252

258-
// Verify
259-
$expected = [
260-
'url' => '{{PageObject}}'
261-
];
262-
$this->assertEquals($expected, $actionObject->getCustomActionAttributes());
253+
$actionObject->getCustomActionAttributes();
263254
}
264255

265256
/**

src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,17 @@ private function resolveUrlReference()
428428
/**
429429
* Returns array of missing references
430430
*
431-
* @param $replacement
431+
* @param string $replacement
432432
* @return array
433433
*/
434434
private function getMissingReferences($replacement): array
435435
{
436436
$mustachePattern = '/({{[\w]+}})|({{[\w]+\.[\w\[\]]+}})|({{[\w]+\.[\w]+\((?(?!}}).)+\)}})/';
437437
preg_match_all($mustachePattern, $replacement, $matches);
438438

439-
return array_filter($matches[1], function($match) { return false === strpos($match, '_ENV.'); });
439+
return array_filter($matches[1], function ($match) {
440+
return false === strpos($match, '_ENV.');
441+
});
440442
}
441443

442444
/**

0 commit comments

Comments
 (0)