@@ -48,9 +48,9 @@ public function testDumpWithReservedWordsAsPlacenames(Definition $definition, st
48
48
}
49
49
50
50
/**
51
- * @dataProvider provideStatemachine
51
+ * @dataProvider provideStateMachine
52
52
*/
53
- public function testDumpAsStatemachine (Definition $ definition , string $ expected )
53
+ public function testDumpAsStateMachine (Definition $ definition , string $ expected )
54
54
{
55
55
$ dumper = new MermaidDumper (MermaidDumper::TRANSITION_TYPE_STATEMACHINE );
56
56
@@ -71,82 +71,82 @@ public function testDumpWorkflowWithMarking(Definition $definition, Marking $mar
71
71
$ this ->assertEquals ($ expected , $ dump );
72
72
}
73
73
74
- public static function provideWorkflowDefinitionWithoutMarking (): array
74
+ public static function provideWorkflowDefinitionWithoutMarking (): iterable
75
75
{
76
- return [
77
- [
78
- self :: createComplexWorkflowDefinition (),
79
- " graph LR \n"
80
- . " a0([ \" a \" ] ) \n"
81
- . " b1 (( \"b \")) \n"
82
- . " c2 (( \"c \")) \n"
83
- . " d3 (( \"d \")) \n"
84
- . " e4 (( \"e \")) \n"
85
- . " f5 (( \"f \")) \n"
86
- . " g6(( \" g \" )) \n"
87
- . " transition0[ \" t1 \" ] \n"
88
- . " a0 -->transition0 \n"
89
- ."transition0-->b1 \n"
90
- . " transition0-->c2 \n"
91
- . " transition1[ \" t2 \" ] \n"
92
- . " b1 -->transition1 \n"
93
- . " transition1 -->d3 \n"
94
- . " c2-->transition1 \n"
95
- . " transition2[ \" My custom transition label 1 \" ] \n"
96
- . " d3-->transition2 \n"
97
- . " linkStyle 6 stroke:Red \n"
98
- . " transition2-->e4 \n"
99
- . " linkStyle 7 stroke:Red \n"
100
- . " transition3[ \" t4 \" ] \n"
101
- . " d3 -->transition3 \n"
102
- . " transition3-->f5 \n"
103
- . " transition4[ \" t5 \" ] \n"
104
- . " e4 -->transition4 \n"
105
- . " transition4-->g6 \n"
106
- . " transition5[ \" t6 \" ] \n"
107
- . " f5 -->transition5 \n "
108
- . ' transition5-->g6 ' ,
109
- ],
110
- [
111
- self ::createWorkflowWithSameNameTransition (),
112
- "graph LR \n"
113
- . " a0 ([ \"a \"]) \n"
114
- . " b1 (( \"b \")) \n"
115
- . " c2 (( \"c \")) \n"
116
- ."transition0[ \"a_to_bc \"] \n"
117
- . " a0 -->transition0 \n"
118
- ."transition0-->b1 \n"
119
- ."transition0-->c2 \n"
120
- ."transition1[ \"b_to_c \"] \n"
121
- . " b1 -->transition1 \n"
122
- ."transition1-->c2 \n"
123
- ."transition2[ \"to_a \"] \n"
124
- . " b1 -->transition2 \n"
125
- ."transition2-->a0 \n"
126
- ."transition3[ \"to_a \"] \n"
127
- . " c2 -->transition3 \n"
128
- . ' transition3-->a0 ' ,
129
- ],
130
- [
131
- self :: createSimpleWorkflowDefinition (),
132
- " graph LR \n"
133
- . " a0([ \" a \" ]) \n"
134
- . " b1(( \" b \" ) ) \n"
135
- . " c2 (( \"c \")) \n"
136
- . " style c2 fill:DeepSkyBlue \n"
137
- . " transition0[ \" My custom transition label 2 \" ] \n"
138
- . " a0-->transition0 \n"
139
- . " linkStyle 0 stroke:Grey \n"
140
- . " transition0-->b1 \n"
141
- . " linkStyle 1 stroke:Grey \n"
142
- . " transition1[ \" t2 \" ] \n"
143
- . " b1--> transition1 \n"
144
- . ' transition1 -->c2 ' ,
145
- ],
76
+ yield [
77
+ self :: createComplexWorkflowDefinition (),
78
+ " graph LR \n"
79
+ . " place0([ \" a \" ]) \n"
80
+ . " place1(( \" b \" ) ) \n"
81
+ . " place2 (( \"c \")) \n"
82
+ . " place3 (( \"d \")) \n"
83
+ . " place4 (( \"e \")) \n"
84
+ . " place5 (( \"f \")) \n"
85
+ . " place6 (( \"g \")) \n"
86
+ . " transition0[ \" t1 \" ] \n"
87
+ . " place0--> transition0 \n"
88
+ . " transition0 -->place1 \n"
89
+ ."transition0-->place2 \n"
90
+ . " transition1[ \" t2 \" ] \n"
91
+ . " place1--> transition1 \n"
92
+ . " transition1 -->place3 \n"
93
+ . " place2 -->transition1 \n"
94
+ . " transition2[ \" My custom transition label 1 \" ] \n"
95
+ . " place3--> transition2 \n"
96
+ . " linkStyle 6 stroke:Red \n"
97
+ . " transition2-->place4 \n"
98
+ . " linkStyle 7 stroke:Red \n"
99
+ . " transition3[ \" t4 \" ] \n"
100
+ . " place3--> transition3 \n"
101
+ . " transition3 -->place5 \n"
102
+ . " transition4[ \" t5 \" ] \n"
103
+ . " place4--> transition4 \n"
104
+ . " transition4 -->place6 \n"
105
+ . " transition5[ \" t6 \" ] \n"
106
+ . " place5--> transition5 \n"
107
+ . " transition5 -->place6 "
108
+
109
+ ];
110
+ yield [
111
+ self ::createWorkflowWithSameNameTransition (),
112
+ "graph LR \n"
113
+ . " place0 ([ \"a \"]) \n"
114
+ . " place1 (( \"b \")) \n"
115
+ . " place2 (( \"c \")) \n"
116
+ ."transition0[ \"a_to_bc \"] \n"
117
+ . " place0 -->transition0 \n"
118
+ ."transition0-->place1 \n"
119
+ ."transition0-->place2 \n"
120
+ ."transition1[ \"b_to_c \"] \n"
121
+ . " place1 -->transition1 \n"
122
+ ."transition1-->place2 \n"
123
+ ."transition2[ \"to_a \"] \n"
124
+ . " place1 -->transition2 \n"
125
+ ."transition2-->place0 \n"
126
+ ."transition3[ \"to_a \"] \n"
127
+ . " place2 -->transition3 \n"
128
+ . " transition3-->place0 "
129
+
130
+ ];
131
+ yield [
132
+ self :: createSimpleWorkflowDefinition (),
133
+ " graph LR \n"
134
+ . " place0([ \" a \" ] ) \n"
135
+ . " place1 (( \"b \")) \n"
136
+ . " place2(( \" c \" )) \n"
137
+ . " style place2 fill:DeepSkyBlue \n"
138
+ . " transition0[ \" My custom transition label 2 \" ] \n"
139
+ . " place0-->transition0 \n"
140
+ . " linkStyle 0 stroke:Grey \n"
141
+ . " transition0-->place1 \n"
142
+ . " linkStyle 1 stroke:Grey \n"
143
+ . " transition1[ \" t2 \" ] \n"
144
+ . " place1 -->transition1 \n"
145
+ . " transition1-->place2 "
146
146
];
147
147
}
148
148
149
- public static function provideWorkflowWithReservedWords (): array
149
+ public static function provideWorkflowWithReservedWords (): iterable
150
150
{
151
151
$ builder = new DefinitionBuilder ();
152
152
@@ -158,69 +158,66 @@ public static function provideWorkflowWithReservedWords(): array
158
158
159
159
$ definition = $ builder ->build ();
160
160
161
- return [
162
- [
163
- $ definition ,
164
- "graph LR \n"
165
- ."start0([ \"start \"]) \n"
166
- ."subgraph1(( \"subgraph \")) \n"
167
- ."end2(( \"end \")) \n"
168
- ."finis3(( \"finis \")) \n"
169
- ."transition0[ \"t0 \"] \n"
170
- ."start0-->transition0 \n"
171
- ."transition0-->end2 \n"
172
- ."subgraph1-->transition0 \n"
173
- ."transition1[ \"t1 \"] \n"
174
- ."end2-->transition1 \n"
175
- .'transition1-->finis3 ' ,
176
- ],
161
+ yield [
162
+ $ definition ,
163
+ "graph LR \n"
164
+ ."place0([ \"start \"]) \n"
165
+ ."place1(( \"subgraph \")) \n"
166
+ ."place2(( \"end \")) \n"
167
+ ."place3(( \"finis \")) \n"
168
+ ."transition0[ \"t0 \"] \n"
169
+ ."place0-->transition0 \n"
170
+ ."transition0-->place2 \n"
171
+ ."place1-->transition0 \n"
172
+ ."transition1[ \"t1 \"] \n"
173
+ ."place2-->transition1 \n"
174
+ ."transition1-->place3 "
175
+
177
176
];
178
177
}
179
178
180
- public static function provideStatemachine (): array
179
+ public static function provideStateMachine (): iterable
181
180
{
182
- return [
183
- [
184
- self ::createComplexStateMachineDefinition (),
185
- "graph LR \n"
186
- ."a0([ \"a \"]) \n"
187
- ."b1(( \"b \")) \n"
188
- ."c2(( \"c \")) \n"
189
- ."d3(( \"d \")) \n"
190
- ."a0-->| \"t1 \"|b1 \n"
191
- ."d3-->| \"My custom transition label 3 \"|b1 \n"
192
- ."linkStyle 1 stroke:Grey \n"
193
- ."b1-->| \"t2 \"|c2 \n"
194
- .'b1-->|"t3"|d3 ' ,
195
- ],
181
+ yield [
182
+ self ::createComplexStateMachineDefinition (),
183
+ "graph LR \n"
184
+ ."place0([ \"a \"]) \n"
185
+ ."place1(( \"b \")) \n"
186
+ ."place2(( \"c \")) \n"
187
+ ."place3(( \"d \")) \n"
188
+ ."place0-->| \"t1 \"|place1 \n"
189
+ ."place3-->| \"My custom transition label 3 \"|place1 \n"
190
+ ."linkStyle 1 stroke:Grey \n"
191
+ ."place1-->| \"t2 \"|place2 \n"
192
+ ."place1-->| \"t3 \"|place3 "
193
+
196
194
];
197
195
}
198
196
199
- public static function provideWorkflowWithMarking (): array
197
+ public static function provideWorkflowWithMarking (): iterable
200
198
{
201
199
$ marking = new Marking ();
202
200
$ marking ->mark ('b ' );
203
201
$ marking ->mark ('c ' );
204
202
205
- return [
206
- [
207
- self ::createSimpleWorkflowDefinition (),
208
- $ marking ,
209
- "graph LR \n"
210
- ."a0([ \"a \"]) \n"
211
- ."b1(( \"b \")) \n"
212
- ."style b1 stroke-width:4px \n"
213
- ."c2(( \"c \")) \n"
214
- ."style c2 fill:DeepSkyBlue,stroke-width:4px \n"
215
- ."transition0[ \"My custom transition label 2 \"] \n"
216
- ."a0-->transition0 \n"
217
- ."linkStyle 0 stroke:Grey \n"
218
- ."transition0-->b1 \n"
219
- ."linkStyle 1 stroke:Grey \n"
220
- ."transition1[ \"t2 \"] \n"
221
- ."b1-->transition1 \n"
222
- .'transition1-->c2 ' ,
223
- ],
203
+ yield [
204
+ self ::createSimpleWorkflowDefinition (),
205
+ $ marking ,
206
+ "graph LR \n"
207
+ ."place0([ \"a \"]) \n"
208
+ ."place1(( \"b \")) \n"
209
+ ."style place1 stroke-width:4px \n"
210
+ ."place2(( \"c \")) \n"
211
+ ."style place2 fill:DeepSkyBlue,stroke-width:4px \n"
212
+ ."transition0[ \"My custom transition label 2 \"] \n"
213
+ ."place0-->transition0 \n"
214
+ ."linkStyle 0 stroke:Grey \n"
215
+ ."transition0-->place1 \n"
216
+ ."linkStyle 1 stroke:Grey \n"
217
+ ."transition1[ \"t2 \"] \n"
218
+ ."place1-->transition1 \n"
219
+ ."transition1-->place2 "
220
+
224
221
];
225
222
}
226
223
}
0 commit comments