File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
src/Symfony/Component/Workflow 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()
345
345
$ this ->assertTrue ($ marking ->has ('d ' ));
346
346
}
347
347
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
+
348
367
public function testApplyWithEventDispatcher ()
349
368
{
350
369
$ definition = $ this ->createComplexWorkflowDefinition ();
Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ public function apply($subject, $transitionName)
139
139
140
140
$ transitionBlockerList = null ;
141
141
$ applied = false ;
142
+ $ approvedTransitionQueue = array ();
142
143
143
144
foreach ($ this ->definition ->getTransitions () as $ transition ) {
144
145
if ($ transition ->getName () !== $ transitionName ) {
@@ -149,7 +150,10 @@ public function apply($subject, $transitionName)
149
150
if (!$ transitionBlockerList ->isEmpty ()) {
150
151
continue ;
151
152
}
153
+ $ approvedTransitionQueue [] = $ transition ;
154
+ }
152
155
156
+ foreach ($ approvedTransitionQueue as $ transition ) {
153
157
$ applied = true ;
154
158
155
159
$ this ->leave ($ subject , $ transition , $ marking );
You can’t perform that action at this time.
0 commit comments