@@ -129,20 +129,15 @@ private function extractClassVar($beforeArray, $afterArray)
129
129
*/
130
130
private function buildHookMustacheArray ($ hookObj )
131
131
{
132
- $ mustacheHookArray = [];
133
132
$ actions = [];
134
- $ hasWebDriverActions = false ;
133
+ $ mustacheHookArray [ ' actions ' ][] = [ ' webDriverInit ' => true ] ;
135
134
136
135
foreach ($ hookObj ->getActions () as $ action ) {
137
136
/** @var ActionObject $action */
138
137
$ index = count ($ actions );
139
138
//deleteData contains either url or createDataKey, if it contains the former it needs special formatting
140
139
if ($ action ->getType () !== "createData "
141
140
&& !array_key_exists (TestGenerator::REQUIRED_ENTITY_REFERENCE , $ action ->getCustomActionAttributes ())) {
142
- if (!$ hasWebDriverActions ) {
143
- $ hasWebDriverActions = true ;
144
- }
145
-
146
141
$ actions = $ this ->buildWebDriverActionsMustacheArray ($ action , $ actions , $ index );
147
142
continue ;
148
143
}
@@ -159,11 +154,8 @@ private function buildHookMustacheArray($hookObj)
159
154
$ entityArray = $ this ->buildPersistenceMustacheArray ($ action , $ entityArray );
160
155
$ actions [$ index ] = $ entityArray ;
161
156
}
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 ];
167
159
168
160
return $ mustacheHookArray ;
169
161
}
0 commit comments