12
12
use Symfony \Component \Workflow \Marking ;
13
13
use Symfony \Component \Workflow \MarkingStore \MarkingStoreInterface ;
14
14
use Symfony \Component \Workflow \MarkingStore \MethodMarkingStore ;
15
- use Symfony \Component \Workflow \MarkingStore \MultipleStateMarkingStore ;
16
15
use Symfony \Component \Workflow \Transition ;
17
16
use Symfony \Component \Workflow \TransitionBlocker ;
18
17
use Symfony \Component \Workflow \Workflow ;
@@ -21,6 +20,9 @@ class WorkflowTest extends TestCase
21
20
{
22
21
use WorkflowBuilderTrait;
23
22
23
+ /**
24
+ * @group legacy
25
+ */
24
26
public function testGetMarkingWithInvalidStoreReturn ()
25
27
{
26
28
$ this ->expectException ('Symfony\Component\Workflow\Exception\LogicException ' );
@@ -36,7 +38,7 @@ public function testGetMarkingWithEmptyDefinition()
36
38
$ this ->expectException ('Symfony\Component\Workflow\Exception\LogicException ' );
37
39
$ this ->expectExceptionMessage ('The Marking is empty and there is no initial place for workflow "unnamed". ' );
38
40
$ subject = new Subject ();
39
- $ workflow = new Workflow (new Definition ([], []), new MultipleStateMarkingStore ());
41
+ $ workflow = new Workflow (new Definition ([], []), new MethodMarkingStore ());
40
42
41
43
$ workflow ->getMarking ($ subject );
42
44
}
@@ -47,7 +49,7 @@ public function testGetMarkingWithImpossiblePlace()
47
49
$ this ->expectExceptionMessage ('Place "nope" is not valid for workflow "unnamed". ' );
48
50
$ subject = new Subject ();
49
51
$ subject ->setMarking (['nope ' => 1 ]);
50
- $ workflow = new Workflow (new Definition ([], []), new MultipleStateMarkingStore ());
52
+ $ workflow = new Workflow (new Definition ([], []), new MethodMarkingStore ());
51
53
52
54
$ workflow ->getMarking ($ subject );
53
55
}
@@ -56,7 +58,7 @@ public function testGetMarkingWithEmptyInitialMarking()
56
58
{
57
59
$ definition = $ this ->createComplexWorkflowDefinition ();
58
60
$ subject = new Subject ();
59
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
61
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
60
62
61
63
$ marking = $ workflow ->getMarking ($ subject );
62
64
@@ -70,7 +72,7 @@ public function testGetMarkingWithExistingMarking()
70
72
$ definition = $ this ->createComplexWorkflowDefinition ();
71
73
$ subject = new Subject ();
72
74
$ subject ->setMarking (['b ' => 1 , 'c ' => 1 ]);
73
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
75
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
74
76
75
77
$ marking = $ workflow ->getMarking ($ subject );
76
78
@@ -83,7 +85,7 @@ public function testCanWithUnexistingTransition()
83
85
{
84
86
$ definition = $ this ->createComplexWorkflowDefinition ();
85
87
$ subject = new Subject ();
86
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
88
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
87
89
88
90
$ this ->assertFalse ($ workflow ->can ($ subject , 'foobar ' ));
89
91
}
@@ -92,7 +94,7 @@ public function testCan()
92
94
{
93
95
$ definition = $ this ->createComplexWorkflowDefinition ();
94
96
$ subject = new Subject ();
95
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
97
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
96
98
97
99
$ this ->assertTrue ($ workflow ->can ($ subject , 't1 ' ));
98
100
$ this ->assertFalse ($ workflow ->can ($ subject , 't2 ' ));
@@ -123,7 +125,7 @@ public function testCanWithGuard()
123
125
$ eventDispatcher ->addListener ('workflow.workflow_name.guard.t1 ' , function (GuardEvent $ event ) {
124
126
$ event ->setBlocked (true );
125
127
});
126
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ eventDispatcher , 'workflow_name ' );
128
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ eventDispatcher , 'workflow_name ' );
127
129
128
130
$ this ->assertFalse ($ workflow ->can ($ subject , 't1 ' ));
129
131
}
@@ -136,7 +138,7 @@ public function testCanDoesNotTriggerGuardEventsForNotEnabledTransitions()
136
138
$ dispatchedEvents = [];
137
139
$ eventDispatcher = new EventDispatcher ();
138
140
139
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ eventDispatcher , 'workflow_name ' );
141
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ eventDispatcher , 'workflow_name ' );
140
142
$ workflow ->apply ($ subject , 't1 ' );
141
143
$ workflow ->apply ($ subject , 't2 ' );
142
144
@@ -155,7 +157,7 @@ public function testCanDoesNotTriggerGuardEventsForNotEnabledTransitions()
155
157
public function testCanWithSameNameTransition ()
156
158
{
157
159
$ definition = $ this ->createWorkflowWithSameNameTransition ();
158
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
160
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
159
161
160
162
$ subject = new Subject ();
161
163
$ this ->assertTrue ($ workflow ->can ($ subject , 'a_to_bc ' ));
@@ -183,7 +185,7 @@ public function testBuildTransitionBlockerList()
183
185
{
184
186
$ definition = $ this ->createComplexWorkflowDefinition ();
185
187
$ subject = new Subject ();
186
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
188
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
187
189
188
190
$ this ->assertTrue ($ workflow ->buildTransitionBlockerList ($ subject , 't1 ' )->isEmpty ());
189
191
$ this ->assertFalse ($ workflow ->buildTransitionBlockerList ($ subject , 't2 ' )->isEmpty ());
@@ -208,7 +210,7 @@ public function testBuildTransitionBlockerListReturnsReasonsProvidedByMarking()
208
210
{
209
211
$ definition = $ this ->createComplexWorkflowDefinition ();
210
212
$ subject = new Subject ();
211
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
213
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
212
214
213
215
$ transitionBlockerList = $ workflow ->buildTransitionBlockerList ($ subject , 't2 ' );
214
216
$ this ->assertCount (1 , $ transitionBlockerList );
@@ -222,7 +224,7 @@ public function testBuildTransitionBlockerListReturnsReasonsProvidedInGuards()
222
224
$ definition = $ this ->createSimpleWorkflowDefinition ();
223
225
$ subject = new Subject ();
224
226
$ dispatcher = new EventDispatcher ();
225
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ dispatcher );
227
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ dispatcher );
226
228
227
229
$ dispatcher ->addListener ('workflow.guard ' , function (GuardEvent $ event ) {
228
230
$ event ->addTransitionBlocker (new TransitionBlocker ('Transition blocker 1 ' , 'blocker_1 ' ));
@@ -254,7 +256,7 @@ public function testApplyWithNotExisingTransition()
254
256
$ this ->expectExceptionMessage ('Transition "404 Not Found" is not defined for workflow "unnamed". ' );
255
257
$ definition = $ this ->createComplexWorkflowDefinition ();
256
258
$ subject = new Subject ();
257
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
259
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
258
260
259
261
$ workflow ->apply ($ subject , '404 Not Found ' );
260
262
}
@@ -263,7 +265,7 @@ public function testApplyWithNotEnabledTransition()
263
265
{
264
266
$ definition = $ this ->createComplexWorkflowDefinition ();
265
267
$ subject = new Subject ();
266
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
268
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
267
269
268
270
try {
269
271
$ workflow ->apply ($ subject , 't2 ' );
@@ -284,7 +286,7 @@ public function testApply()
284
286
{
285
287
$ definition = $ this ->createComplexWorkflowDefinition ();
286
288
$ subject = new Subject ();
287
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
289
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
288
290
289
291
$ marking = $ workflow ->apply ($ subject , 't1 ' );
290
292
@@ -298,7 +300,7 @@ public function testApplyWithSameNameTransition()
298
300
{
299
301
$ subject = new Subject ();
300
302
$ definition = $ this ->createWorkflowWithSameNameTransition ();
301
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
303
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
302
304
303
305
$ marking = $ workflow ->apply ($ subject , 'a_to_bc ' );
304
306
@@ -336,7 +338,7 @@ public function testApplyWithSameNameTransition2()
336
338
$ transitions [] = new Transition ('t ' , 'a ' , 'c ' );
337
339
$ transitions [] = new Transition ('t ' , 'b ' , 'd ' );
338
340
$ definition = new Definition ($ places , $ transitions );
339
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
341
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
340
342
341
343
$ marking = $ workflow ->apply ($ subject , 't ' );
342
344
@@ -357,7 +359,7 @@ public function testApplyWithSameNameTransition3()
357
359
$ transitions [] = new Transition ('t ' , 'b ' , 'c ' );
358
360
$ transitions [] = new Transition ('t ' , 'c ' , 'd ' );
359
361
$ definition = new Definition ($ places , $ transitions );
360
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
362
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
361
363
362
364
$ marking = $ workflow ->apply ($ subject , 't ' );
363
365
// We want to make sure we do not end up in "d"
@@ -370,7 +372,7 @@ public function testApplyWithEventDispatcher()
370
372
$ definition = $ this ->createComplexWorkflowDefinition ();
371
373
$ subject = new Subject ();
372
374
$ eventDispatcher = new EventDispatcherMock ();
373
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ eventDispatcher , 'workflow_name ' );
375
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ eventDispatcher , 'workflow_name ' );
374
376
375
377
$ eventNameExpected = [
376
378
'workflow.entered ' ,
@@ -417,7 +419,7 @@ public function testApplyDoesNotTriggerExtraGuardWithEventDispatcher()
417
419
418
420
$ subject = new Subject ();
419
421
$ eventDispatcher = new EventDispatcherMock ();
420
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ eventDispatcher , 'workflow_name ' );
422
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ eventDispatcher , 'workflow_name ' );
421
423
422
424
$ eventNameExpected = [
423
425
'workflow.entered ' ,
@@ -470,7 +472,7 @@ public function testEventName()
470
472
$ subject = new Subject ();
471
473
$ dispatcher = new EventDispatcher ();
472
474
$ name = 'workflow_name ' ;
473
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ dispatcher , $ name );
475
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ dispatcher , $ name );
474
476
475
477
$ assertWorkflowName = function (Event $ event ) use ($ name ) {
476
478
$ this ->assertEquals ($ name , $ event ->getWorkflowName ());
@@ -501,7 +503,7 @@ public function testMarkingStateOnApplyWithEventDispatcher()
501
503
502
504
$ dispatcher = new EventDispatcher ();
503
505
504
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ dispatcher , 'test ' );
506
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ dispatcher , 'test ' );
505
507
506
508
$ assertInitialState = function (Event $ event ) {
507
509
$ this ->assertEquals (new Marking (['a ' => 1 , 'b ' => 1 , 'c ' => 1 ]), $ event ->getMarking ());
@@ -535,7 +537,7 @@ public function testGetEnabledTransitions()
535
537
$ eventDispatcher ->addListener ('workflow.workflow_name.guard.t1 ' , function (GuardEvent $ event ) {
536
538
$ event ->setBlocked (true );
537
539
});
538
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ eventDispatcher , 'workflow_name ' );
540
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore (), $ eventDispatcher , 'workflow_name ' );
539
541
540
542
$ this ->assertEmpty ($ workflow ->getEnabledTransitions ($ subject ));
541
543
@@ -555,7 +557,7 @@ public function testGetEnabledTransitionsWithSameNameTransition()
555
557
{
556
558
$ definition = $ this ->createWorkflowWithSameNameTransition ();
557
559
$ subject = new Subject ();
558
- $ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
560
+ $ workflow = new Workflow ($ definition , new MethodMarkingStore ());
559
561
560
562
$ transitions = $ workflow ->getEnabledTransitions ($ subject );
561
563
$ this ->assertCount (1 , $ transitions );
0 commit comments