@@ -106,7 +106,17 @@ public function testPfopExecuteWithOptions()
106
106
$ testCases = $ this ->pfopOptionsTestData ();
107
107
108
108
foreach ($ testCases as $ testCase ) {
109
- if ($ testCase ['workflowTemplateID ' ]) {
109
+ $ workflowTemplateID = null ;
110
+ $ type = null ;
111
+
112
+ if (array_key_exists ('workflowTemplateID ' , $ testCase )) {
113
+ $ workflowTemplateID = $ testCase ['workflowTemplateID ' ];
114
+ }
115
+ if (array_key_exists ('type ' , $ testCase )) {
116
+ $ type = $ testCase ['type ' ];
117
+ }
118
+
119
+ if ($ workflowTemplateID ) {
110
120
$ fops = null ;
111
121
} else {
112
122
$ persistentEntry = \Qiniu \entry (
@@ -116,7 +126,7 @@ public function testPfopExecuteWithOptions()
116
126
array (
117
127
'test-pfop/test-pfop-by-api ' ,
118
128
'type ' ,
119
- $ testCase [ ' type ' ]
129
+ $ type
120
130
)
121
131
)
122
132
);
@@ -129,24 +139,24 @@ public function testPfopExecuteWithOptions()
129
139
null ,
130
140
null ,
131
141
false ,
132
- $ testCase [ ' type ' ] ,
133
- $ testCase [ ' workflowTemplateID ' ]
142
+ $ type ,
143
+ $ workflowTemplateID
134
144
);
135
145
136
- if (in_array ($ testCase [ ' type ' ] , array (null , 0 , 1 ))) {
146
+ if (in_array ($ type , array (null , 0 , 1 ))) {
137
147
$ this ->assertNull ($ error );
138
148
list ($ status , $ error ) = $ pfop ->status ($ id );
139
149
$ this ->assertNotNull ($ status );
140
150
$ this ->assertNull ($ error );
141
- if ($ testCase [ ' type ' ] == 1 ) {
151
+ if ($ type == 1 ) {
142
152
$ this ->assertEquals (1 , $ status ['type ' ]);
143
153
}
144
- if ($ testCase [ ' workflowTemplateID ' ] ) {
154
+ if ($ workflowTemplateID ) {
145
155
// assertStringContainsString when PHPUnit >= 8.0
146
156
$ this ->assertTrue (
147
157
strpos (
148
158
$ status ['taskFrom ' ],
149
- $ testCase [ ' workflowTemplateID ' ]
159
+ $ workflowTemplateID
150
160
) !== false
151
161
);
152
162
}
@@ -166,11 +176,21 @@ public function testPfopWithUploadPolicy()
166
176
$ testCases = $ this ->pfopOptionsTestData ();
167
177
168
178
foreach ($ testCases as $ testCase ) {
179
+ $ workflowTemplateID = null ;
180
+ $ type = null ;
181
+
182
+ if (array_key_exists ('workflowTemplateID ' , $ testCase )) {
183
+ $ workflowTemplateID = $ testCase ['workflowTemplateID ' ];
184
+ }
185
+ if (array_key_exists ('type ' , $ testCase )) {
186
+ $ type = $ testCase ['type ' ];
187
+ }
188
+
169
189
$ putPolicy = array (
170
- 'persistentType ' => $ testCase [ ' type ' ]
190
+ 'persistentType ' => $ type
171
191
);
172
- if ($ testCase [ ' workflowTemplateID ' ] ) {
173
- $ putPolicy ['persistentWorkflowTemplateID ' ] = $ testCase [ ' workflowTemplateID ' ] ;
192
+ if ($ workflowTemplateID ) {
193
+ $ putPolicy ['persistentWorkflowTemplateID ' ] = $ workflowTemplateID ;
174
194
} else {
175
195
$ persistentEntry = \Qiniu \entry (
176
196
$ bucket ,
@@ -179,14 +199,14 @@ public function testPfopWithUploadPolicy()
179
199
array (
180
200
'test-pfop/test-pfop-by-upload ' ,
181
201
'type ' ,
182
- $ testCase [ ' type ' ]
202
+ $ type
183
203
)
184
204
)
185
205
);
186
206
$ putPolicy ['persistentOps ' ] = 'avinfo|saveas/ ' . $ persistentEntry ;
187
207
}
188
208
189
- if ($ testCase [ ' type ' ] == null ) {
209
+ if ($ type == null ) {
190
210
unset($ putPolicy ['persistentType ' ]);
191
211
}
192
212
@@ -206,7 +226,7 @@ public function testPfopWithUploadPolicy()
206
226
true
207
227
);
208
228
209
- if (in_array ($ testCase [ ' type ' ] , array (null , 0 , 1 ))) {
229
+ if (in_array ($ type , array (null , 0 , 1 ))) {
210
230
$ this ->assertNull ($ error );
211
231
$ this ->assertNotEmpty ($ ret ['persistentId ' ]);
212
232
$ id = $ ret ['persistentId ' ];
@@ -220,15 +240,15 @@ public function testPfopWithUploadPolicy()
220
240
221
241
$ this ->assertNotNull ($ status );
222
242
$ this ->assertNull ($ error );
223
- if ($ testCase [ ' type ' ] == 1 ) {
243
+ if ($ type == 1 ) {
224
244
$ this ->assertEquals (1 , $ status ['type ' ]);
225
245
}
226
- if ($ testCase [ ' workflowTemplateID ' ] ) {
246
+ if ($ workflowTemplateID ) {
227
247
// assertStringContainsString when PHPUnit >= 8.0
228
248
$ this ->assertTrue (
229
249
strpos (
230
250
$ status ['taskFrom ' ],
231
- $ testCase [ ' workflowTemplateID ' ]
251
+ $ workflowTemplateID
232
252
) !== false
233
253
);
234
254
}
0 commit comments