@@ -481,6 +481,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
481
481
$ visible = null ;
482
482
$ command = null ;
483
483
$ sortOrder = null ;
484
+ $ storeCode = null ;
484
485
485
486
$ assertExpected = null ;
486
487
$ assertActual = null ;
@@ -635,6 +636,9 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
635
636
$ visible = $ customActionAttributes ['visible ' ];
636
637
}
637
638
639
+ if (isset ($ customActionAttributes ['storeCode ' ])) {
640
+ $ storeCode = $ customActionAttributes ['storeCode ' ];
641
+ }
638
642
switch ($ actionObject ->getType ()) {
639
643
case "createData " :
640
644
$ entity = $ customActionAttributes ['entity ' ];
@@ -691,8 +695,8 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
691
695
);
692
696
}
693
697
694
- if (isset ($ customActionAttributes [ ' storeCode ' ] )) {
695
- $ createEntityFunctionCall .= sprintf ("\"%s \"); \n" , $ customActionAttributes [ ' storeCode ' ] );
698
+ if (isset ($ storeCode )) {
699
+ $ createEntityFunctionCall .= sprintf ("\"%s \"); \n" , $ storeCode );
696
700
} else {
697
701
$ createEntityFunctionCall .= "); \n" ;
698
702
}
@@ -716,34 +720,29 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
716
720
if (isset ($ customActionAttributes ['createDataKey ' ])) {
717
721
$ key = $ customActionAttributes ['createDataKey ' ];
718
722
//Add an informative statement to help the user debug test runs
719
- $ testSteps . = sprintf (
723
+ $ contextSetter = sprintf (
720
724
"\t\t$%s->amGoingTo( \"delete entity that has the createDataKey: %s \"); \n" ,
721
725
$ actor ,
722
726
$ key
723
727
);
728
+ $ deleteEntityFunctionCall = "" ;
724
729
725
730
if ($ hookObject ) {
726
- $ testSteps .= sprintf ("\t\t\$this->%s->deleteEntity(); \n" , $ key );
731
+ $ deleteEntityFunctionCall .= sprintf ("\t\t\$this->%s->deleteEntity(); \n" , $ key );
727
732
} else {
728
- $ testSteps .= sprintf ("\t\t$%s->deleteEntity(); \n" , $ key );
733
+ $ deleteEntityFunctionCall .= sprintf ("\t\t$%s->deleteEntity(); \n" , $ key );
729
734
}
735
+
736
+ $ testSteps .= $ contextSetter ;
737
+ $ testSteps .= $ deleteEntityFunctionCall ;
730
738
} else {
731
739
$ output = sprintf (
732
- "\t\t$%s->deleteEntityByUrl(%s " ,
740
+ "\t\t$%s->deleteEntityByUrl(%s); \n " ,
733
741
$ actor ,
734
742
$ url
735
743
);
736
- $ storeCode = null ;
737
- if (isset ($ customActionAttributes ["storeCode " ])) {
738
- $ storeCode = $ customActionAttributes ["storeCode " ];
739
- $ output .= sprintf (
740
- ", %s " ,
741
- $ storeCode
742
- );
743
- }
744
- $ output .= "); \n" ;
745
- $ output = $ this ->resolveEnvReferences ($ output , [$ url , $ storeCode ]);
746
- $ testSteps .= $ this ->resolveTestVariable ($ output , [$ url , $ storeCode ], null );
744
+ $ output = $ this ->resolveEnvReferences ($ output , [$ url ]);
745
+ $ testSteps .= $ this ->resolveTestVariable ($ output , [$ url ], null );
747
746
}
748
747
break ;
749
748
case "updateData " :
@@ -792,8 +791,8 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
792
791
);
793
792
}
794
793
795
- if (isset ($ customActionAttributes [ ' storeCode ' ] )) {
796
- $ updateEntityFunctionCall .= sprintf ("\"%s \"); \n" , $ customActionAttributes [ ' storeCode ' ] );
794
+ if (isset ($ storeCode )) {
795
+ $ updateEntityFunctionCall .= sprintf (", \"%s \"); \n" , $ storeCode );
797
796
} else {
798
797
$ updateEntityFunctionCall .= "); \n" ;
799
798
}
@@ -854,13 +853,13 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
854
853
}
855
854
856
855
if (isset ($ customActionAttributes ['index ' ])) {
857
- $ getEntityFunctionCall .= sprintf ("%s " , (int )$ customActionAttributes ['index ' ]);
856
+ $ getEntityFunctionCall .= sprintf (", %s " , (int )$ customActionAttributes ['index ' ]);
858
857
} else {
859
858
$ getEntityFunctionCall .= 'null ' ;
860
859
}
861
860
862
- if (isset ($ customActionAttributes [ ' storeCode ' ] )) {
863
- $ getEntityFunctionCall .= sprintf (", \"%s \"); \n" , $ customActionAttributes [ ' storeCode ' ] );
861
+ if (isset ($ storeCode )) {
862
+ $ getEntityFunctionCall .= sprintf (", \"%s \"); \n" , $ storeCode );
864
863
} else {
865
864
$ getEntityFunctionCall .= "); \n" ;
866
865
}
0 commit comments