File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ public function execute(
71
71
if (is_array ($ fops )) {
72
72
$ fops = implode ('; ' , $ fops );
73
73
}
74
+
75
+ if (!$ fops && !$ workflow_template_id ) {
76
+ throw new \InvalidArgumentException ('Must provide one of fops or template_id ' );
77
+ }
78
+
74
79
$ params = array ('bucket ' => $ bucket , 'key ' => $ key );
75
80
\Qiniu \setWithoutEmpty ($ params , 'fops ' , $ fops );
76
81
\Qiniu \setWithoutEmpty ($ params , 'pipeline ' , $ pipeline );
Original file line number Diff line number Diff line change @@ -167,6 +167,30 @@ public function testPfopExecuteWithOptions()
167
167
}
168
168
}
169
169
170
+ public function testPfopWithInvalidArgument ()
171
+ {
172
+ $ bucket = self ::$ bucketName ;
173
+ $ key = 'qiniu.png ' ;
174
+ $ pfop = new PersistentFop (self ::$ testAuth , self ::getConfig ());
175
+ $ err = null ;
176
+ try {
177
+ $ pfop ->execute (
178
+ $ bucket ,
179
+ $ key
180
+ );
181
+ } catch (\Exception $ e ) {
182
+ $ err = $ e ;
183
+ }
184
+
185
+ $ this ->assertNotEmpty ($ err );
186
+ $ this ->assertTrue (
187
+ strpos (
188
+ $ err ->getMessage (),
189
+ 'Must provide one of fops or template_id '
190
+ ) !== false
191
+ );
192
+ }
193
+
170
194
public function testPfopWithUploadPolicy ()
171
195
{
172
196
$ bucket = self ::$ bucketName ;
You can’t perform that action at this time.
0 commit comments