File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed 
lib/OpenCloud/ObjectStore 
tests/OpenCloud/Tests/ObjectStore Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ public function listContainers(array $filter = array())
9292     */ 
9393    public  function  getContainer ($ datanull )
9494    {
95+         if  (is_string ($ datais_numeric ($ data
96+             $ this checkContainerName ($ data
97+         }
98+ 
9599        return  new  Container ($ this $ data
96100    }
97101
Original file line number Diff line number Diff line change @@ -99,6 +99,48 @@ public function test_Bad_Container_Name_Long()
9999        $ this service ->createContainer (str_repeat ('a ' , Service::MAX_CONTAINER_NAME_LENGTH  + 1 ));
100100    }
101101
102+     /** 
103+      * @expectedException OpenCloud\Common\Exceptions\InvalidArgumentError 
104+      */ 
105+     public  function  test_Get_Bad_Container_Name_Empty ()
106+     {
107+         $ this service ->getContainer ('' );
108+     }
109+ 
110+     /** 
111+      * @expectedException OpenCloud\Common\Exceptions\InvalidArgumentError 
112+      */ 
113+     public  function  test_Get_Bad_Container_Name_Slashes ()
114+     {
115+         $ this service ->getContainer ('foo/bar ' );
116+     }
117+ 
118+     /** 
119+      * @expectedException OpenCloud\Common\Exceptions\InvalidArgumentError 
120+      */ 
121+     public  function  test_Get_Bad_Container_Name_Long ()
122+     {
123+         $ this service ->getContainer (str_repeat ('a ' , Service::MAX_CONTAINER_NAME_LENGTH  + 1 ));
124+     }
125+ 
126+     /** 
127+      * @expectedException OpenCloud\Common\Exceptions\InvalidArgumentError 
128+      */ 
129+     public  function  test_Get_Bad_Container_Name_Float ()
130+     {
131+         $ this service ->getContainer (4.5 );
132+     }
133+ 
134+     public  function  test_Get_Container_String ()
135+     {
136+         $ this assertInstanceOf ('OpenCloud\ObjectStore\Resource\Container ' , $ this service ->getContainer ('foo ' ));
137+     }
138+ 
139+     public  function  test_Get_Container_Integer ()
140+     {
141+         $ this assertInstanceOf ('OpenCloud\ObjectStore\Resource\Container ' , $ this service ->getContainer (1 ));
142+     }
143+ 
102144    public  function  test_Bulk_Extract ()
103145    {
104146        $ response$ this service ->bulkExtract ('fooBarContainer ' , 'CONTENT ' , UrlType::TAR );
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments