diff --git a/features/backend/files_manager/basic_sequence_files_manager.feature b/features/backend/files_manager/basic_sequence_files_manager.feature index 68d5d7ffb..06088e786 100644 --- a/features/backend/files_manager/basic_sequence_files_manager.feature +++ b/features/backend/files_manager/basic_sequence_files_manager.feature @@ -86,7 +86,7 @@ Feature: Files Manager Resources #Para que funcione este test, debe existir el archivo que se quiere subir Scenario: Post files - Given POST I want to upload the file "/home/daniel/test.txt" to path "public". Url to create prf_uid "project/1265557095225ff5c688f46031700471/file-manager" and updload "project/1265557095225ff5c688f46031700471/file-manager/upload" + Given POST I want to upload the file "/home/daniel/test.txt" to path "public". Url to create prf_uid "project/1265557095225ff5c688f46031700471/file-manager" and updload "project/1265557095225ff5c688f46031700471/file-manager" Scenario: Delete file Given that I want to delete a "public/test.txt" diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index e6e26edca..5e577044d 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1329,18 +1329,22 @@ class RestContext extends BehatContext $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$postUrl); curl_setopt($ch, CURLOPT_HTTPHEADER,$headr); - curl_setopt($ch, CURLOPT_POSTFIELDS, array('prf_filename'=>$sfile, "prf_path" => $path, "prf_content" => "")); + curl_setopt($ch, CURLOPT_POSTFIELDS, array('prf_filename'=>$sfile, "prf_path" => $path, "prf_content" => NULL)); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); curl_close($ch); - $aResult = explode(",",$postResult); - $aFileUid = explode(":",$aResult[0]); - $prfUid = trim(str_replace('"','',$aFileUid[1])); + $postResult = (array)json_decode($postResult); + if (sizeof($postResult) > 2) { + $prfUid = $postResult["prf_uid"]; + } else { + var_dump($postResult["error"]); + } + $url = $url.$prfUid."/upload"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HTTPHEADER,$headr); - curl_setopt($ch, CURLOPT_POSTFIELDS, array('my_file'=>'@'.$prfFile, 'prf_uid' => $prfUid)); + curl_setopt($ch, CURLOPT_POSTFIELDS, array('prf_file'=>'@'.$prfFile)); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch);