@@ -898,7 +898,12 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
898898 $ stepKey ,
899899 $ customActionAttributes ['class ' ] . ':: ' . $ customActionAttributes ['method ' ]
900900 );
901- $ testSteps .= $ this ->wrapFunctionCall ($ actor , $ actionObject , $ arguments );
901+ $ testSteps .= $ this ->wrapFunctionCallWithReturnValue (
902+ $ stepKey ,
903+ $ actor ,
904+ $ actionObject ,
905+ $ arguments
906+ );
902907 break ;
903908 case "createData " :
904909 $ entity = $ customActionAttributes ['entity ' ];
@@ -2016,16 +2021,7 @@ private function addDollarSign($input)
20162021 */
20172022 private function wrapFunctionCall ($ actor , $ action , ...$ args )
20182023 {
2019- $ isFirst = true ;
2020- $ isActionHelper = $ action ->getType () === 'helper ' ;
2021- $ actionType = $ action ->getType ();
2022- if ($ isActionHelper ) {
2023- $ actor = "this->helperContainer->get(' " . $ action ->getCustomActionAttributes ()['class ' ] . "') " ;
2024- $ args = $ args [0 ];
2025- $ actionType = $ action ->getCustomActionAttributes ()['method ' ];
2026- }
2027-
2028- $ output = sprintf ("\t\t$%s->%s( " , $ actor , $ actionType );
2024+ $ output = sprintf ("\t\t$%s->%s( " , $ actor , $ action ->getType ());
20292025 for ($ i = 0 ; $ i < count ($ args ); $ i ++) {
20302026 if (null === $ args [$ i ]) {
20312027 continue ;
@@ -2046,17 +2042,22 @@ private function wrapFunctionCall($actor, $action, ...$args)
20462042 /**
20472043 * Wrap parameters into a function call with a return value.
20482044 *
2049- * @param string $returnVariable
2050- * @param string $actor
2051- * @param string $action
2052- * @param array ...$args
2045+ * @param string $returnVariable
2046+ * @param string $actor
2047+ * @param actionObject $action
2048+ * @param array ...$args
20532049 * @return string
20542050 * @throws \Exception
20552051 */
20562052 private function wrapFunctionCallWithReturnValue ($ returnVariable , $ actor , $ action , ...$ args )
20572053 {
2058- $ isFirst = true ;
2059- $ output = sprintf ("\t\t$%s = $%s->%s( " , $ returnVariable , $ actor , $ action ->getType ());
2054+ $ actionType = $ action ->getType ();
2055+ if ($ actionType === 'helper ' ) {
2056+ $ actor = "this->helperContainer->get(' " . $ action ->getCustomActionAttributes ()['class ' ] . "') " ;
2057+ $ args = $ args [0 ];
2058+ $ actionType = $ action ->getCustomActionAttributes ()['method ' ];
2059+ }
2060+ $ output = sprintf ("\t\t$%s = $%s->%s( " , $ returnVariable , $ actor , $ actionType );
20602061 for ($ i = 0 ; $ i < count ($ args ); $ i ++) {
20612062 if (null === $ args [$ i ]) {
20622063 continue ;
0 commit comments