예제 #1
0
파일: Request.php 프로젝트: OpenBX/obx.core
 public function testDownload404()
 {
     try {
         $Request = new Request(static::$_url404);
         $Request->downloadToFile('/upload/obx.core/test/Request/404/404.json');
     } catch (RequestError $e) {
         $this->assertEquals(RequestError::E_FILE_SAVE_NO_RESPONSE, $e->getCode());
         $this->assertEquals(RequestError::getLangMessage(RequestError::E_FILE_SAVE_NO_RESPONSE), $e->getMessage());
     }
     $this->assertEquals('404', $Request->getStatus());
     $this->assertFileNotExists(self::$_docRoot . '/upload/obx.core/test/Request/404/404.json');
     $RequestAllowSave404 = new Request(static::$_url404);
     $RequestAllowSave404->setAllowSave404ToFile();
     $RequestAllowSave404->downloadToDir('/upload/obx.core/test/Request/404/', Request::SAVE_TO_DIR_COUNT);
     $this->assertEquals('404', $RequestAllowSave404->getStatus());
     $this->assertFileExists(self::$_docRoot . '/upload/obx.core/test/Request/404/test.response.json');
 }