33 * Copyright © Magento, Inc. All rights reserved.
44 * See COPYING.txt for license details.
55 */
6+ declare (strict_types=1 );
7+
68namespace tests \unit \Magento \FunctionalTestFramework \Test \Util ;
79
810use Magento \FunctionalTestingFramework \DataGenerator \Handlers \DataObjectHandler ;
1214use Magento \FunctionalTestingFramework \Test \Objects \ActionObject ;
1315use Magento \FunctionalTestingFramework \Test \Util \ActionMergeUtil ;
1416use Magento \FunctionalTestingFramework \Test \Util \ActionObjectExtractor ;
17+ use ReflectionProperty ;
1518use tests \unit \Util \MagentoTestCase ;
1619use tests \unit \Util \TestLoggingUtil ;
1720
1821class ActionMergeUtilTest extends MagentoTestCase
1922{
2023 /**
21- * Before test functionality
24+ * Before test functionality.
25+ *
2226 * @return void
2327 */
24- public function setUp (): void
28+ protected function setUp (): void
2529 {
2630 TestLoggingUtil::getInstance ()->setMockLoggingUtil ();
2731 }
@@ -30,8 +34,10 @@ public function setUp(): void
3034 * Test to validate actions are properly ordered during a merge.
3135 *
3236 * @return void
37+ * @throws TestReferenceException
38+ * @throws XmlException
3339 */
34- public function testResolveActionStepOrdering ()
40+ public function testResolveActionStepOrdering (): void
3541 {
3642 $ actions = [];
3743 $ actionsLength = 11 ;
@@ -45,7 +51,6 @@ public function testResolveActionStepOrdering()
4551 $ stepKey = 'stepKey ' . $ i ;
4652 $ type = 'testType ' ;
4753 $ actionAttributes = [];
48-
4954 $ actions [] = new ActionObject ($ stepKey , $ type , $ actionAttributes );
5055 }
5156
@@ -92,8 +97,10 @@ public function testResolveActionStepOrdering()
9297 * Test to validate action steps properly resolve entity data references.
9398 *
9499 * @return void
100+ * @throws TestReferenceException
101+ * @throws XmlException
95102 */
96- public function testResolveActionStepEntityData ()
103+ public function testResolveActionStepEntityData (): void
97104 {
98105 $ dataObjectName = 'myObject ' ;
99106 $ dataObjectType = 'testObject ' ;
@@ -110,40 +117,34 @@ public function testResolveActionStepEntityData()
110117
111118 // Set up mock DataObject Handler
112119 $ mockDOHInstance = $ this ->createMock (DataObjectHandler::class);
113- $ mockDOHInstance ->expects ($ this ->any ())
120+ $ mockDOHInstance
121+ ->expects ($ this ->any ())
114122 ->method ('getObject ' )
115123 ->willReturn ($ mockDataObject );
116- $ property = new \ ReflectionProperty (DataObjectHandler::class, 'INSTANCE ' );
124+ $ property = new ReflectionProperty (DataObjectHandler::class, 'INSTANCE ' );
117125 $ property ->setAccessible (true );
118- $ property ->setValue ($ mockDOHInstance );
126+ $ property ->setValue ($ mockDOHInstance, $ mockDOHInstance );
119127
120128 // Create test object and action object
121129 $ actionAttributes = [$ userInputKey => $ userInputValue ];
122130 $ actions [$ actionName ] = new ActionObject ($ actionName , $ actionType , $ actionAttributes );
123-
124131 $ this ->assertEquals ($ userInputValue , $ actions [$ actionName ]->getCustomActionAttributes ()[$ userInputKey ]);
125132
126133 $ mergeUtil = new ActionMergeUtil ("test " , "TestCase " );
127134 $ resolvedActions = $ mergeUtil ->resolveActionSteps ($ actions );
128-
129135 $ this ->assertEquals ($ dataFieldValue , $ resolvedActions [$ actionName ]->getCustomActionAttributes ()[$ userInputKey ]);
130136 }
131137
132138 /**
133139 * Verify that an XmlException is thrown when an action references a non-existant action.
134140 *
135- * @throws TestReferenceException
136- * @throws XmlException
137141 * @return void
138- */
139- /**
140142 * @throws TestReferenceException
141143 * @throws XmlException
142144 */
143- public function testNoActionException ()
145+ public function testNoActionException (): void
144146 {
145147 $ actionObjects = [];
146-
147148 $ actionObjects [] = new ActionObject ('actionKey1 ' , 'bogusType ' , []);
148149 $ actionObjects [] = new ActionObject (
149150 'actionKey2 ' ,
@@ -153,20 +154,19 @@ public function testNoActionException()
153154 ActionObject::MERGE_ACTION_ORDER_BEFORE
154155 );
155156
156- $ this ->expectException (\Magento \FunctionalTestingFramework \Exceptions \XmlException::class);
157-
157+ $ this ->expectException (XmlException::class);
158158 $ actionMergeUtil = new ActionMergeUtil ("actionMergeUtilTest " , "TestCase " );
159159 $ actionMergeUtil ->resolveActionSteps ($ actionObjects );
160160 }
161161
162162 /**
163163 * Verify that a <waitForPageLoad> action is added after actions that have a wait (timeout property).
164164 *
165+ * @return void
165166 * @throws TestReferenceException
166167 * @throws XmlException
167- * @return void
168168 */
169- public function testInsertWait ()
169+ public function testInsertWait (): void
170170 {
171171 $ actionObjectOne = new ActionObject ('actionKey1 ' , 'bogusType ' , []);
172172 $ actionObjectOne ->setTimeout (42 );
@@ -189,10 +189,11 @@ public function testInsertWait()
189189 /**
190190 * Verify that a <fillField> action is replaced by <fillSecretField> when secret _CREDS are referenced.
191191 *
192+ * @return void
192193 * @throws TestReferenceException
193194 * @throws XmlException
194195 */
195- public function testValidFillFieldSecretFunction ()
196+ public function testValidFillFieldSecretFunction (): void
196197 {
197198 $ actionObjectOne = new ActionObject (
198199 'actionKey1 ' ,
@@ -202,7 +203,6 @@ public function testValidFillFieldSecretFunction()
202203 $ actionObject = [$ actionObjectOne ];
203204
204205 $ actionMergeUtil = new ActionMergeUtil ('actionMergeUtilTest ' , 'TestCase ' );
205-
206206 $ result = $ actionMergeUtil ->resolveActionSteps ($ actionObject );
207207
208208 $ expectedValue = new ActionObject (
@@ -216,10 +216,11 @@ public function testValidFillFieldSecretFunction()
216216 /**
217217 * Verify that a <magentoCLI> action uses <magentoCLI> when secret _CREDS are referenced.
218218 *
219+ * @return void
219220 * @throws TestReferenceException
220221 * @throws XmlException
221222 */
222- public function testValidMagentoCLISecretFunction ()
223+ public function testValidMagentoCLISecretFunction (): void
223224 {
224225 $ actionObjectOne = new ActionObject (
225226 'actionKey1 ' ,
@@ -229,7 +230,6 @@ public function testValidMagentoCLISecretFunction()
229230 $ actionObject = [$ actionObjectOne ];
230231
231232 $ actionMergeUtil = new ActionMergeUtil ('actionMergeUtilTest ' , 'TestCase ' );
232-
233233 $ result = $ actionMergeUtil ->resolveActionSteps ($ actionObject );
234234
235235 $ expectedValue = new ActionObject (
@@ -243,10 +243,11 @@ public function testValidMagentoCLISecretFunction()
243243 /**
244244 * Verify that a <field> override in a <createData> action uses <field> when secret _CREDS are referenced.
245245 *
246+ * @return void
246247 * @throws TestReferenceException
247248 * @throws XmlException
248249 */
249- public function testValidCreateDataSecretFunction ()
250+ public function testValidCreateDataSecretFunction (): void
250251 {
251252 $ actionObjectOne = new ActionObject (
252253 'actionKey1 ' ,
@@ -256,7 +257,6 @@ public function testValidCreateDataSecretFunction()
256257 $ actionObject = [$ actionObjectOne ];
257258
258259 $ actionMergeUtil = new ActionMergeUtil ('actionMergeUtilTest ' , 'TestCase ' );
259-
260260 $ result = $ actionMergeUtil ->resolveActionSteps ($ actionObject );
261261
262262 $ expectedValue = new ActionObject (
@@ -270,10 +270,11 @@ public function testValidCreateDataSecretFunction()
270270 /**
271271 * Verify that a <click> action throws an exception when secret _CREDS are referenced.
272272 *
273+ * @return void
273274 * @throws TestReferenceException
274275 * @throws XmlException
275276 */
276- public function testInvalidSecretFunctions ()
277+ public function testInvalidSecretFunctions (): void
277278 {
278279 $ this ->expectException (TestReferenceException::class);
279280 $ this ->expectExceptionMessage (
@@ -292,7 +293,8 @@ public function testInvalidSecretFunctions()
292293 }
293294
294295 /**
295- * After class functionality
296+ * After class functionality.
297+ *
296298 * @return void
297299 */
298300 public static function tearDownAfterClass (): void
0 commit comments