@@ -129,20 +129,15 @@ private function extractClassVar($beforeArray, $afterArray)
129129 */
130130 private function buildHookMustacheArray ($ hookObj )
131131 {
132- $ mustacheHookArray = [];
133132 $ actions = [];
134- $ hasWebDriverActions = false ;
133+ $ mustacheHookArray [ ' actions ' ][] = [ ' webDriverInit ' => true ] ;
135134
136135 foreach ($ hookObj ->getActions () as $ action ) {
137136 /** @var ActionObject $action */
138137 $ index = count ($ actions );
139138 //deleteData contains either url or createDataKey, if it contains the former it needs special formatting
140139 if ($ action ->getType () !== "createData "
141140 && !array_key_exists (TestGenerator::REQUIRED_ENTITY_REFERENCE , $ action ->getCustomActionAttributes ())) {
142- if (!$ hasWebDriverActions ) {
143- $ hasWebDriverActions = true ;
144- }
145-
146141 $ actions = $ this ->buildWebDriverActionsMustacheArray ($ action , $ actions , $ index );
147142 continue ;
148143 }
@@ -159,11 +154,8 @@ private function buildHookMustacheArray($hookObj)
159154 $ entityArray = $ this ->buildPersistenceMustacheArray ($ action , $ entityArray );
160155 $ actions [$ index ] = $ entityArray ;
161156 }
162- $ mustacheHookArray ['actions ' ] = $ actions ;
163- if ($ hasWebDriverActions ) {
164- array_unshift ($ mustacheHookArray ['actions ' ], ['webDriverInit ' => true ]);
165- $ mustacheHookArray ['actions ' ][] = ['webDriverReset ' => true ];
166- }
157+ $ mustacheHookArray ['actions ' ] = array_merge ($ mustacheHookArray ['actions ' ], $ actions );
158+ $ mustacheHookArray ['actions ' ][] = ['webDriverReset ' => true ];
167159
168160 return $ mustacheHookArray ;
169161 }
0 commit comments