示例#1
0
 public function testSaveContentToDir()
 {
     $Request = new Request(self::$_urlJSON . '&test=testSaveContentToDir&download=Y');
     $body = $Request->send();
     $Request->saveToDir('/upload/obx.core/test/Request/toDir/', Request::SAVE_TO_DIR_REPLACE);
     $this->assertFileExists(self::$_docRoot . '/upload/obx.core/test/Request/toDir/testSaveContentToDir.json');
     $fileContent = file_get_contents(self::$_docRoot . '/upload/obx.core/test/Request/toDir/testSaveContentToDir.json');
     $arJSONFileContent = json_decode($fileContent, true);
     $this->assertTrue(is_array($arJSONFileContent));
     $this->assertArrayHasKey('get', $arJSONFileContent);
     $this->assertArrayHasKey('test', $arJSONFileContent['get']);
     $this->assertEquals('testSaveContentToDir', $arJSONFileContent['get']['test']);
     $arContentJSON = json_decode($body, true);
     $this->assertTrue(is_array($arContentJSON));
     $this->assertArrayHasKey('get', $arContentJSON);
     $this->assertArrayHasKey('test', $arContentJSON['get']);
     $this->assertEquals('testSaveContentToDir', $arContentJSON['get']['test']);
 }