File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -345,6 +345,25 @@ public function testApplyWithSameNameTransition2()
345345 $ this ->assertTrue ($ marking ->has ('d ' ));
346346 }
347347
348+ public function testApplyWithSameNameTransition3 ()
349+ {
350+ $ subject = new \stdClass ();
351+ $ subject ->marking = array ('a ' => 1 );
352+
353+ $ places = range ('a ' , 'd ' );
354+ $ transitions = array ();
355+ $ transitions [] = new Transition ('t ' , 'a ' , 'b ' );
356+ $ transitions [] = new Transition ('t ' , 'b ' , 'c ' );
357+ $ transitions [] = new Transition ('t ' , 'c ' , 'd ' );
358+ $ definition = new Definition ($ places , $ transitions );
359+ $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
360+
361+ $ marking = $ workflow ->apply ($ subject , 't ' );
362+ // We want to make sure we do not end up in "d"
363+ $ this ->assertTrue ($ marking ->has ('b ' ));
364+ $ this ->assertFalse ($ marking ->has ('d ' ));
365+ }
366+
348367 public function testApplyWithEventDispatcher ()
349368 {
350369 $ definition = $ this ->createComplexWorkflowDefinition ();
Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ public function apply($subject, $transitionName)
139139
140140 $ transitionBlockerList = null ;
141141 $ applied = false ;
142+ $ approvedTransitionQueue = array ();
142143
143144 foreach ($ this ->definition ->getTransitions () as $ transition ) {
144145 if ($ transition ->getName () !== $ transitionName ) {
@@ -149,7 +150,10 @@ public function apply($subject, $transitionName)
149150 if (!$ transitionBlockerList ->isEmpty ()) {
150151 continue ;
151152 }
153+ $ approvedTransitionQueue [] = $ transition ;
154+ }
152155
156+ foreach ($ approvedTransitionQueue as $ transition ) {
153157 $ applied = true ;
154158
155159 $ this ->leave ($ subject , $ transition , $ marking );
You can’t perform that action at this time.
0 commit comments