@@ -898,7 +898,12 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
898
898
$ stepKey ,
899
899
$ customActionAttributes ['class ' ] . ':: ' . $ customActionAttributes ['method ' ]
900
900
);
901
- $ testSteps .= $ this ->wrapFunctionCall ($ actor , $ actionObject , $ arguments );
901
+ $ testSteps .= $ this ->wrapFunctionCallWithReturnValue (
902
+ $ stepKey ,
903
+ $ actor ,
904
+ $ actionObject ,
905
+ $ arguments
906
+ );
902
907
break ;
903
908
case "createData " :
904
909
$ entity = $ customActionAttributes ['entity ' ];
@@ -2016,16 +2021,7 @@ private function addDollarSign($input)
2016
2021
*/
2017
2022
private function wrapFunctionCall ($ actor , $ action , ...$ args )
2018
2023
{
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 ());
2029
2025
for ($ i = 0 ; $ i < count ($ args ); $ i ++) {
2030
2026
if (null === $ args [$ i ]) {
2031
2027
continue ;
@@ -2046,17 +2042,22 @@ private function wrapFunctionCall($actor, $action, ...$args)
2046
2042
/**
2047
2043
* Wrap parameters into a function call with a return value.
2048
2044
*
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
2053
2049
* @return string
2054
2050
* @throws \Exception
2055
2051
*/
2056
2052
private function wrapFunctionCallWithReturnValue ($ returnVariable , $ actor , $ action , ...$ args )
2057
2053
{
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 );
2060
2061
for ($ i = 0 ; $ i < count ($ args ); $ i ++) {
2061
2062
if (null === $ args [$ i ]) {
2062
2063
continue ;
0 commit comments