Se mejora BEHAT FILESMANAGER.

This commit is contained in:
Freddy Daniel Rojas Valda
2014-02-25 09:17:11 -04:00
parent 75cf6e3eea
commit d50cd2a2e1
2 changed files with 10 additions and 6 deletions

View File

@@ -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"

View File

@@ -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);