public function testGetSignedUrlForPuttingObjectFromFile()
 {
     $file = __FILE__;
     $object = "a.file";
     $timeout = 3600;
     $options = array('Content-Type' => 'txt');
     try {
         $signedUrl = $this->ossClient->signUrl($this->bucket, $object, $timeout, "PUT", $options);
         sleep(5);
         $request = new RequestCore($signedUrl);
         $request->set_method('PUT');
         $request->add_header('Content-Type', 'txt');
         $request->set_read_file($file);
         $request->set_read_stream_size(filesize($file));
         $request->send_request();
         $res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
         $this->assertTrue($res->isOK());
     } catch (Exception $e) {
         $this->assertFalse(true);
     }
 }
Пример #2
0
 public function testResponseCore()
 {
     $res = new ResponseCore(null, "", 500);
     $this->assertFalse($res->isOK());
     $this->assertTrue($res->isOK(500));
 }