Se cambia url para download y delete se actualiza BEHAT en FILESMANAGER.
This commit is contained in:
@@ -42,55 +42,52 @@ Feature: Files Manager Resources
|
||||
And store "prf_uid" in session array as variable "prf_uid<i>"
|
||||
|
||||
Examples:
|
||||
| test_description | file_name | path | content | http_code | type |
|
||||
| into public folder | testbehat.txt | public/ | test | 200 | object |
|
||||
| into maintemplates folder | testbehat.txt | templates/ | test | 200 | object |
|
||||
| into public subfolder | testbehat.txt | public/test_folder | test | 200 | object |
|
||||
| into public subfolder | testbehat.txt | templates/test_folder | test | 200 | object |
|
||||
| test_description | file_name | path | content | http_code | type | i |
|
||||
| into public folder | testbehat.txt | public/ | test | 200 | object | 0 |
|
||||
| into mailtemplates folder | testbehat.txt | templates/ | test | 200 | object | 1 |
|
||||
| into public subfolder | testbehat.txt | public/test_folder | test | 200 | object | 2 |
|
||||
| into mailtemplates subfolder | testbehat.txt | templates/test_folder | test | 200 | object | 3 |
|
||||
|
||||
Scenario Outline: Post files
|
||||
Given PUT this data:
|
||||
"""
|
||||
{
|
||||
"prf_filename": "<file_name>",
|
||||
"prf_content": "<content>"
|
||||
}
|
||||
"""
|
||||
And I request "project/1265557095225ff5c688f46031700471/file-manager?path=<path>"
|
||||
And that I want to update a resource with the key "prf_uid" stored in session array as variable "prf_uid<i>"
|
||||
And I request "project/1265557095225ff5c688f46031700471/file-manager"
|
||||
Then the response status code should be <http_code>
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "<type>"
|
||||
|
||||
Examples:
|
||||
| test_description | file_name | path | content | http_code | type |
|
||||
| put into public folder | testbehat.txt | public/ | put test | 200 | object |
|
||||
| put into maintemplates folder | testbehat.txt | templates/ | put test | 200 | object |
|
||||
| put into public subfolder | testbehat.txt | public/test_folder | put test | 200 | object |
|
||||
| put into public subfolder | testbehat.txt | templates/test_folder | put test | 200 | object |
|
||||
|
||||
| test_description | content | http_code | type | i |
|
||||
| put into public folder | put test | 200 | object | 0 |
|
||||
| put into mailtemplates folder | put test | 200 | object | 1 |
|
||||
| put into public subfolder | put test | 200 | object | 2 |
|
||||
| put into mailtemplates subfolder | put test | 200 | object | 3 |
|
||||
|
||||
Scenario Outline: Delete file
|
||||
Given that I want to delete a "<path>"
|
||||
And I request "project/1265557095225ff5c688f46031700471/file-manager?path=<path>"
|
||||
And the content type is "application/json"
|
||||
Given that I want to delete a resource with the key "prf_uid" stored in session array as variable "prf_uid<i>"
|
||||
And I request "project/1265557095225ff5c688f46031700471/file-manager"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
Examples:
|
||||
| test_description | path |
|
||||
| delete public folder | public/testbehat.txt |
|
||||
| delete maintemplates folder | templates/testbehat.txt |
|
||||
| delete public subfolder | public/test_folder/testbehat.txt |
|
||||
| delete public subfolder | templates/test_folder/testbehat.txt |
|
||||
| test_description | i |
|
||||
| delete public folder | 0 |
|
||||
| delete mailtemplates folder | 1 |
|
||||
| delete public subfolder | 2 |
|
||||
| delete mailtemplates subfolder | 3 |
|
||||
|
||||
#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"
|
||||
Given POST I want to upload the file "/home/daniel/test.txt" to path "templates". Url "project/1265557095225ff5c688f46031700471/file-manager"
|
||||
|
||||
Scenario: Delete file
|
||||
Given that I want to delete a "public/test.txt"
|
||||
And I request "project/1265557095225ff5c688f46031700471/file-manager?path=public/test.txt"
|
||||
And the content type is "application/json"
|
||||
Given that I want to delete a resource with the key "prf_uid" stored in session array as variable "prf_uid"
|
||||
And I request "project/1265557095225ff5c688f46031700471/file-manager"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
@@ -1312,14 +1312,13 @@ class RestContext extends BehatContext
|
||||
$this->iRequest($url);
|
||||
}
|
||||
|
||||
//*********** POST - UPLOAD FILE MANAGER
|
||||
//UPLOAD FILE MANAGER
|
||||
/**
|
||||
* @Given /^POST I want to upload the file "([^"]*)" to path "([^"]*)". Url to create prf_uid "([^"]*)" and updload "([^"]*)"$/
|
||||
* @Given /^POST I want to upload the file "([^"]*)" to path "([^"]*)". Url "([^"]*)"$/
|
||||
*/
|
||||
public function postIWantToUploadTheFileToPathPublicUrlToCreatePrfUidAndUpdload($prfFile, $prfPath, $postUrl, $url)
|
||||
public function postIWantToUploadTheFileToPathPublicUrl($prfFile, $prfPath, $url)
|
||||
{
|
||||
$baseUrl = $this->getParameter('base_url');
|
||||
$postUrl = $baseUrl.$postUrl;
|
||||
$url = $baseUrl.$url;
|
||||
$accesstoken = $this->getParameter('access_token');
|
||||
$headr = array();
|
||||
@@ -1327,7 +1326,7 @@ class RestContext extends BehatContext
|
||||
$path = rtrim($prfPath, '/') . '/';
|
||||
$sfile = end(explode("/",$prfFile));
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,$postUrl);
|
||||
curl_setopt($ch, CURLOPT_URL,$url);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
|
||||
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');
|
||||
@@ -1340,7 +1339,7 @@ class RestContext extends BehatContext
|
||||
} else {
|
||||
var_dump($postResult["error"]);
|
||||
}
|
||||
$url = $url.$prfUid."/upload";
|
||||
$url = $url.'/'.$prfUid."/upload";
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,$url);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
|
||||
@@ -1349,9 +1348,15 @@ class RestContext extends BehatContext
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$postResult = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
//se guarda el prf_uid en una variable
|
||||
$varName = 'prf_uid';
|
||||
$sessionData = new StdClass();
|
||||
$sessionData->$varName = $prfUid;
|
||||
file_put_contents("session.data", json_encode($sessionData));
|
||||
}
|
||||
|
||||
//*********** POST - UPLOAD IMAGE
|
||||
//UPLOAD IMAGE
|
||||
/**
|
||||
* @Given /^POST I want to upload the image "([^"]*)" to user "([^"]*)". Url "([^"]*)"$/
|
||||
*/
|
||||
@@ -1378,7 +1383,7 @@ class RestContext extends BehatContext
|
||||
. curl_error($ch));
|
||||
}
|
||||
curl_close($ch);
|
||||
echo $postResult;
|
||||
echo $postResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user