Skip to content

Commit 15d61bb

Browse files
committed
Change Unit Tests to cover the change (including Exception thrown)
1 parent e06c188 commit 15d61bb

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
class ActionObjectTest extends MagentoTestCase
2626
{
27+
const STUB_PAGE_URL_WITH_NO_ATTRIBUTE = '{{PageObject}}/some/path';
28+
2729
/**
2830
* Before test functionality
2931
* @return void
@@ -233,10 +235,11 @@ public function testResolveUrl()
233235
*/
234236
public function testResolveUrlWithNoAttribute()
235237
{
236-
// Set up mocks
238+
// Given
237239
$actionObject = new ActionObject('merge123', 'amOnPage', [
238-
'url' => '{{PageObject}}'
240+
'url' => self::STUB_PAGE_URL_WITH_NO_ATTRIBUTE
239241
]);
242+
240243
$pageObject = new PageObject('PageObject', '/replacement/url.html', 'Test', [], false, "test");
241244
$pageObjectList = ["PageObject" => $pageObject];
242245
$instance = AspectMock::double(
@@ -245,12 +248,15 @@ public function testResolveUrlWithNoAttribute()
245248
)->make(); // bypass the private constructor
246249
AspectMock::double(PageObjectHandler::class, ['getInstance' => $instance]);
247250

248-
// Call the method under test
249-
$actionObject->resolveReferences();
250-
251+
// Expect
251252
$this->expectExceptionMessage('Can not resolve replacements: "{{PageObject}}"');
253+
$expected = [
254+
'url' => self::STUB_PAGE_URL_WITH_NO_ATTRIBUTE
255+
];
252256

253-
$actionObject->getCustomActionAttributes();
257+
// When
258+
$actionObject->resolveReferences();
259+
$this->assertEquals($expected, $actionObject->getCustomActionAttributes());
254260
}
255261

256262
/**

0 commit comments

Comments
 (0)