Se adiciona BEHAT para FILES MANAGER. Se arreglos en FILES MANAGER
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Files Manager Resources
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
Scenario: Get a list of main process files manager
|
||||
Given I request "project/1265557095225ff5c688f46031700471/process-file-manager"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
|
||||
Scenario: Get a list public folder of process files manager
|
||||
Given I request "project/1265557095225ff5c688f46031700471/process-file-manager?path=public"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
|
||||
Scenario: Get a list templates folder of process files manager
|
||||
Given I request "project/1265557095225ff5c688f46031700471/process-file-manager?path=templates"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
|
||||
Scenario Outline: Post files
|
||||
Given POST this data:
|
||||
"""
|
||||
{
|
||||
"file_name": "<file_name>",
|
||||
"path": "<path>",
|
||||
"content": "<content>"
|
||||
}
|
||||
"""
|
||||
And I request "project/1265557095225ff5c688f46031700471/process-file-manager"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "<type>"
|
||||
And store "prf_uid" in session array as variable "prf_uid<i>"
|
||||
|
||||
Examples:
|
||||
| test_description | file_name | path | content | http_code | type | i |
|
||||
| into public folder | test.txt | public/ | test | 200 | object | 0 |
|
||||
| into maintemplates folder | test.txt | templates/ | test | 200 | object | 1 |
|
||||
| into public subfolder | test.txt | public/test_folder | test | 200 | object | 2 |
|
||||
| into public subfolder | test.txt | templates/test_folder | test | 200 | object | 3 |
|
||||
|
||||
|
||||
|
||||
Scenario Outline: Post files
|
||||
Given PUT this data:
|
||||
"""
|
||||
{
|
||||
"file_name": "<file_name>",
|
||||
"content": "<content>"
|
||||
}
|
||||
"""
|
||||
And I request "project/1265557095225ff5c688f46031700471/process-file-manager?path=<path>"
|
||||
Then the response status code should be 200
|
||||
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 | test.txt | public/ | put test | 200 | object |
|
||||
| put into maintemplates folder | test.txt | templates/ | put test | 200 | object |
|
||||
| put into public subfolder | test.txt | public/test_folder | put test | 200 | object |
|
||||
| put into public subfolder | test.txt | templates/test_folder | put test | 200 | object |
|
||||
|
||||
Scenario Outline: Delete User
|
||||
Given that I want to delete a "<path>"
|
||||
And I request "project/1265557095225ff5c688f46031700471/process-file-manager?path=<path>"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
Examples:
|
||||
| test_description | path |
|
||||
| put into public folder | public/test.txt |
|
||||
| put into maintemplates folder | templates/test.txt |
|
||||
| put into public subfolder | public/test_folder/test.txt |
|
||||
| put into public subfolder | templates/test_folder/test.txt |
|
||||
@@ -54,7 +54,7 @@ class FilesManager
|
||||
case 'templates':
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory;
|
||||
break;
|
||||
case 'folder':
|
||||
case 'public':
|
||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory;
|
||||
break;
|
||||
default:
|
||||
@@ -115,8 +115,8 @@ class FilesManager
|
||||
try {
|
||||
$aData['path'] = rtrim($aData['path'], '/') . '/';
|
||||
$sMainDirectory = current(explode("/", $aData['path']));
|
||||
if ($sMainDirectory != 'folder' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `folder/`'));
|
||||
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `public/`'));
|
||||
}
|
||||
if(strstr($aData['path'],'/')){
|
||||
$sSubDirectory = substr($aData['path'], strpos($aData['path'], "/")+1) ;
|
||||
@@ -129,7 +129,7 @@ class FilesManager
|
||||
$sCheckDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory;
|
||||
$sEditable = false;
|
||||
break;
|
||||
case 'folder':
|
||||
case 'public':
|
||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['file_name'];
|
||||
$sCheckDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory;
|
||||
break;
|
||||
@@ -235,8 +235,8 @@ class FilesManager
|
||||
try {
|
||||
$path = rtrim($path, '/') . '/';
|
||||
$sMainDirectory = current(explode("/", $path));
|
||||
if ($sMainDirectory != 'folder' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `folder/`'));
|
||||
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `public/`'));
|
||||
}
|
||||
if(strstr($path,'/')){
|
||||
$sSubDirectory = substr($path, strpos($path, "/")+1) ;
|
||||
@@ -248,7 +248,7 @@ class FilesManager
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['file_name'];
|
||||
$sEditable = false;
|
||||
break;
|
||||
case 'folder':
|
||||
case 'public':
|
||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['file_name'];
|
||||
break;
|
||||
default:
|
||||
@@ -309,12 +309,10 @@ class FilesManager
|
||||
{
|
||||
try {
|
||||
$sMainDirectory = current(explode("/", $path));
|
||||
if ($sMainDirectory != 'folder' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `folder/`'));
|
||||
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `public/`'));
|
||||
}
|
||||
if ($sMainDirectory == 'folder') {
|
||||
$sMainDirectory = 'public';
|
||||
} else {
|
||||
if ($sMainDirectory == 'templates') {
|
||||
$sMainDirectory = 'mailTemplates';
|
||||
}
|
||||
$sfile = end(explode("/",$path));
|
||||
@@ -367,12 +365,10 @@ class FilesManager
|
||||
{
|
||||
try {
|
||||
$sMainDirectory = current(explode("/", $path));
|
||||
if ($sMainDirectory != 'folder' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `folder/`'));
|
||||
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `public/`'));
|
||||
}
|
||||
if ($sMainDirectory == 'folder') {
|
||||
$sMainDirectory = 'public';
|
||||
} else {
|
||||
if ($sMainDirectory == 'templates') {
|
||||
$sMainDirectory = 'mailTemplates';
|
||||
}
|
||||
$sfile = end(explode("/",$path));
|
||||
|
||||
@@ -61,7 +61,7 @@ class FilesManager extends Api
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url POST /:prjUid/process-file-manager-upload
|
||||
* @url POST /:prjUid/process-file-manager/upload
|
||||
*/
|
||||
public function doPostProcessFilesManagerUpload($prjUid)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ class FilesManager extends Api
|
||||
*
|
||||
* @url GET /:prjUid/process-file-manager/download
|
||||
*/
|
||||
public function doDownloadProcessFilesManager($prjUid, $path)
|
||||
public function doGetProcessFilesManagerDownload($prjUid, $path)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \BusinessModel\FilesManager();
|
||||
|
||||
Reference in New Issue
Block a user