File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ public function execute(
7171        if  (is_array ($ fops )) {
7272            $ fops  = implode ('; ' , $ fops );
7373        }
74+ 
75+         if  (!$ fops  && !$ workflow_template_id ) {
76+             throw  new  \InvalidArgumentException ('Must provide one of fops or template_id ' );
77+         }
78+ 
7479        $ params  = array ('bucket '  => $ bucket , 'key '  => $ key );
7580        \Qiniu \setWithoutEmpty ($ params , 'fops ' , $ fops );
7681        \Qiniu \setWithoutEmpty ($ params , 'pipeline ' , $ pipeline );
Original file line number Diff line number Diff line change @@ -167,6 +167,30 @@ public function testPfopExecuteWithOptions()
167167        }
168168    }
169169
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+ 
170194    public  function  testPfopWithUploadPolicy ()
171195    {
172196        $ bucket  = self ::$ bucketName ;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments