@@ -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 ;
@@ -510,6 +511,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
510
511
$ input = $ this ->addUniquenessFunctionCall ($ customActionAttributes ['userInput ' ]);
511
512
} elseif (isset ($ customActionAttributes ['url ' ])) {
512
513
$ input = $ this ->addUniquenessFunctionCall ($ customActionAttributes ['url ' ]);
514
+ $ url = $ this ->addUniquenessFunctionCall ($ customActionAttributes ['url ' ]);
513
515
} elseif (isset ($ customActionAttributes ['expectedValue ' ])) {
514
516
//For old Assert backwards Compatibility, remove when deprecating
515
517
$ assertExpected = $ this ->addUniquenessFunctionCall ($ customActionAttributes ['expectedValue ' ]);
@@ -634,6 +636,9 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
634
636
$ visible = $ customActionAttributes ['visible ' ];
635
637
}
636
638
639
+ if (isset ($ customActionAttributes ['storeCode ' ])) {
640
+ $ storeCode = $ customActionAttributes ['storeCode ' ];
641
+ }
637
642
switch ($ actionObject ->getType ()) {
638
643
case "createData " :
639
644
$ entity = $ customActionAttributes ['entity ' ];
@@ -690,8 +695,8 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
690
695
);
691
696
}
692
697
693
- if (isset ($ customActionAttributes [ ' storeCode ' ] )) {
694
- $ createEntityFunctionCall .= sprintf ("\"%s \"); \n" , $ customActionAttributes [ ' storeCode ' ] );
698
+ if (isset ($ storeCode )) {
699
+ $ createEntityFunctionCall .= sprintf ("\"%s \"); \n" , $ storeCode );
695
700
} else {
696
701
$ createEntityFunctionCall .= "); \n" ;
697
702
}
@@ -712,18 +717,32 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
712
717
$ testSteps .= $ createEntityFunctionCall ;
713
718
break ;
714
719
case "deleteData " :
715
- $ key = $ customActionAttributes ['createDataKey ' ];
716
- //Add an informative statement to help the user debug test runs
717
- $ testSteps .= sprintf (
718
- "\t\t$%s->amGoingTo( \"delete entity that has the createDataKey: %s \"); \n" ,
719
- $ actor ,
720
- $ key
721
- );
720
+ if (isset ($ customActionAttributes ['createDataKey ' ])) {
721
+ $ key = $ customActionAttributes ['createDataKey ' ];
722
+ //Add an informative statement to help the user debug test runs
723
+ $ contextSetter = sprintf (
724
+ "\t\t$%s->amGoingTo( \"delete entity that has the createDataKey: %s \"); \n" ,
725
+ $ actor ,
726
+ $ key
727
+ );
728
+ $ deleteEntityFunctionCall = "" ;
722
729
723
- if ($ hookObject ) {
724
- $ testSteps .= sprintf ("\t\t\$this->%s->deleteEntity(); \n" , $ key );
730
+ if ($ hookObject ) {
731
+ $ deleteEntityFunctionCall .= sprintf ("\t\t\$this->%s->deleteEntity(); \n" , $ key );
732
+ } else {
733
+ $ deleteEntityFunctionCall .= sprintf ("\t\t$%s->deleteEntity(); \n" , $ key );
734
+ }
735
+
736
+ $ testSteps .= $ contextSetter ;
737
+ $ testSteps .= $ deleteEntityFunctionCall ;
725
738
} else {
726
- $ testSteps .= sprintf ("\t\t$%s->deleteEntity(); \n" , $ key );
739
+ $ output = sprintf (
740
+ "\t\t$%s->deleteEntityByUrl(%s); \n" ,
741
+ $ actor ,
742
+ $ url
743
+ );
744
+ $ output = $ this ->resolveEnvReferences ($ output , [$ url ]);
745
+ $ testSteps .= $ this ->resolveTestVariable ($ output , [$ url ], null );
727
746
}
728
747
break ;
729
748
case "updateData " :
@@ -772,8 +791,8 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
772
791
);
773
792
}
774
793
775
- if (isset ($ customActionAttributes [ ' storeCode ' ] )) {
776
- $ updateEntityFunctionCall .= sprintf ("\"%s \"); \n" , $ customActionAttributes [ ' storeCode ' ] );
794
+ if (isset ($ storeCode )) {
795
+ $ updateEntityFunctionCall .= sprintf (", \"%s \"); \n" , $ storeCode );
777
796
} else {
778
797
$ updateEntityFunctionCall .= "); \n" ;
779
798
}
@@ -834,13 +853,13 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
834
853
}
835
854
836
855
if (isset ($ customActionAttributes ['index ' ])) {
837
- $ getEntityFunctionCall .= sprintf ("%s " , (int )$ customActionAttributes ['index ' ]);
856
+ $ getEntityFunctionCall .= sprintf (", %s " , (int )$ customActionAttributes ['index ' ]);
838
857
} else {
839
858
$ getEntityFunctionCall .= 'null ' ;
840
859
}
841
860
842
- if (isset ($ customActionAttributes [ ' storeCode ' ] )) {
843
- $ getEntityFunctionCall .= sprintf (", \"%s \"); \n" , $ customActionAttributes [ ' storeCode ' ] );
861
+ if (isset ($ storeCode )) {
862
+ $ getEntityFunctionCall .= sprintf (", \"%s \"); \n" , $ storeCode );
844
863
} else {
845
864
$ getEntityFunctionCall .= "); \n" ;
846
865
}
0 commit comments