Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Export Process Main Tests
|
||||
Requirements:
|
||||
a workspace with the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") already loaded
|
||||
there are many activities, steps, triggers, pmtables, asignee, events, etc. in the process
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
|
||||
Scenario: Get for Export Project
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/export"
|
||||
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"
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Import/Export Process Main Tests
|
||||
Requirements:
|
||||
a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") already loaded
|
||||
there are many activities, steps, triggers, pmtables, asignee, events, etc. in the process
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
|
||||
Scenario: Get for Export Project
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/export"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/xml"
|
||||
And the type is "array"
|
||||
|
||||
#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc.
|
||||
|
||||
Scenario: Get a List DynaForms of a Project Process Complete BPMN
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/dynaforms"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 26 records
|
||||
|
||||
Scenario: Get the Input Documents List when there are exactly zero input documents
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/input-documents"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get the Output Documents List when there are exactly two output documents
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/output-documents"
|
||||
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"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get the Triggers List when there are exactly two triggers
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/triggers"
|
||||
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"
|
||||
And the response has 3 records
|
||||
|
||||
Scenario Outline: List assignees of each activity
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/activity/<activity>/assignee"
|
||||
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"
|
||||
And the response has <records> records
|
||||
And the "aas_uid" property in row 0 equals "<aas_uid>"
|
||||
And the "aas_type" property in row 0 equals "<aas_type>"
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | records | aas_uid | aas_type |
|
||||
| Verify that the activity has expected quantity of asignees | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group |
|
||||
| Verify that the activity has expected quantity of asignees | 1455892245368ebeb11c1a5001393784 | 4790702485368efad167477011123879 | 1 | 70084316152d56749e0f393054862525 | group |
|
||||
|
||||
Scenario: Get a List of current process supervisors of a project
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/process-supervisors"
|
||||
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"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get a List of current Process Permissions of a project
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/process-permissions"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 1 record
|
||||
|
||||
Scenario: Get a list templates folder of process files manager
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/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"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get a single Process
|
||||
Given that I want to get a resource with the key "obj_uid" stored in session array
|
||||
And I request "project/1455892245368ebeb11c1a5001393784/process"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
And that "pro_title" is set to "Process Complete BPMN"
|
||||
And that "pro_description" is set to ""
|
||||
And that "pro_parent" is set to "1455892245368ebeb11c1a5001393784"
|
||||
And that "pro_time" is set to 1
|
||||
And that "pro_timeunit" is set to "DAYS"
|
||||
And that "pro_status" is set to "ACTIVE"
|
||||
And that "pro_type_day" is set to ""
|
||||
And that "pro_type" is set to "NORMAL"
|
||||
And that "pro_assignment" is set to 0
|
||||
And that "pro_show_map" is set to 0
|
||||
And that "pro_show_message" is set to 1
|
||||
And that "pro_subprocess" is set to 0
|
||||
And that "pro_tri_deleted" is set to "712197294536bea56a8b4d0014148679"
|
||||
And that "pro_tri_canceled" is set to "950769923536bea6a39c833033416052"
|
||||
And that "pro_tri_paused" is set to "350949312536bea73c53791057971272"
|
||||
And that "pro_tri_reassigned" is set to "712197294536bea56a8b4d0014148679"
|
||||
And that "pro_show_delegate" is set to 0
|
||||
And that "pro_show_dynaform" is set to 0
|
||||
And that "pro_category" is set to "4177095085330818c324501061677193"
|
||||
And that "pro_sub_category" is set to ""
|
||||
And that "pro_industry" is set to 0
|
||||
And that "pro_update_date" is set to "null"
|
||||
And that "pro_create_date" is set to "2014-05-06 10:04:27"
|
||||
And that "pro_create_user" is set to "00000000000000000000000000000001"
|
||||
And that "pro_debug" is set to 0
|
||||
And that "pro_derivation_screen_tpl" is set to ""
|
||||
And that "pro_summary_dynaform" is set to "898822326536be3a12addb0034537553"
|
||||
And that "pro_calendar" is set to "14606161052f50839307899033145440"
|
||||
|
||||
#Import Process
|
||||
|
||||
Scenario Outline: Import a process
|
||||
Given POST upload a project file "<project_file>" to "project/import?option=<import_option>"
|
||||
Then the response status code should be 201
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "object"
|
||||
|
||||
|
||||
Examples:
|
||||
| project_file | import_option |
|
||||
| /home/wendy/uploadfiles/Process_NewCreate_BPMN.pmx | create |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | overwrite |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | disable |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | keep |
|
||||
|
||||
|
||||
#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc.
|
||||
|
||||
Scenario: Get a List DynaForms of a Project Process Complete BPMN
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/dynaforms"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 26 records
|
||||
|
||||
Scenario: Get the Input Documents List when there are exactly zero input documents
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/input-documents"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get the Output Documents List when there are exactly two output documents
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/output-documents"
|
||||
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"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get the Triggers List when there are exactly two triggers
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/triggers"
|
||||
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"
|
||||
And the response has 3 records
|
||||
|
||||
Scenario Outline: List assignees of each activity
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/activity/<activity>/assignee"
|
||||
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"
|
||||
And the response has <records> records
|
||||
And the "aas_uid" property in row 0 equals "<aas_uid>"
|
||||
And the "aas_type" property in row 0 equals "<aas_type>"
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | records | aas_uid | aas_type |
|
||||
| Verify that the activity has expected quantity of asignees | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group |
|
||||
| Verify that the activity has expected quantity of asignees | 1455892245368ebeb11c1a5001393784 | 4790702485368efad167477011123879 | 1 | 70084316152d56749e0f393054862525 | group |
|
||||
|
||||
Scenario: Get a List of current process supervisors of a project
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/process-supervisors"
|
||||
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"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get a List of current Process Permissions of a project
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/process-permissions"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 1 record
|
||||
|
||||
Scenario: Get a list templates folder of process files manager
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/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"
|
||||
And the response has 1 records
|
||||
|
||||
Scenario: Get a single Process
|
||||
Given that I want to get a resource with the key "obj_uid" stored in session array
|
||||
And I request "project/1455892245368ebeb11c1a5001393784/process"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
And that "pro_title" is set to "Process Complete BPMN"
|
||||
And that "pro_description" is set to ""
|
||||
And that "pro_parent" is set to "1455892245368ebeb11c1a5001393784"
|
||||
And that "pro_time" is set to 1
|
||||
And that "pro_timeunit" is set to "DAYS"
|
||||
And that "pro_status" is set to "ACTIVE"
|
||||
And that "pro_type_day" is set to ""
|
||||
And that "pro_type" is set to "NORMAL"
|
||||
And that "pro_assignment" is set to 0
|
||||
And that "pro_show_map" is set to 0
|
||||
And that "pro_show_message" is set to 1
|
||||
And that "pro_subprocess" is set to 0
|
||||
And that "pro_tri_deleted" is set to "712197294536bea56a8b4d0014148679"
|
||||
And that "pro_tri_canceled" is set to "950769923536bea6a39c833033416052"
|
||||
And that "pro_tri_paused" is set to "350949312536bea73c53791057971272"
|
||||
And that "pro_tri_reassigned" is set to "712197294536bea56a8b4d0014148679"
|
||||
And that "pro_show_delegate" is set to 0
|
||||
And that "pro_show_dynaform" is set to 0
|
||||
And that "pro_category" is set to "4177095085330818c324501061677193"
|
||||
And that "pro_sub_category" is set to ""
|
||||
And that "pro_industry" is set to 0
|
||||
And that "pro_update_date" is set to "null"
|
||||
And that "pro_create_date" is set to "2014-05-06 10:04:27"
|
||||
And that "pro_create_user" is set to "00000000000000000000000000000001"
|
||||
And that "pro_debug" is set to 0
|
||||
And that "pro_derivation_screen_tpl" is set to ""
|
||||
And that "pro_summary_dynaform" is set to "898822326536be3a12addb0034537553"
|
||||
And that "pro_calendar" is set to "14606161052f50839307899033145440"
|
||||
@@ -1,29 +0,0 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Import Process Main Tests
|
||||
Requirements:
|
||||
a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") already loaded
|
||||
there are many activities, steps, triggers, pmtables, asignee, events, etc. in the process
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
|
||||
Scenario: Get for Export Project
|
||||
Given I request "project/1455892245368ebeb11c1a5001393784/export"
|
||||
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: Import a process
|
||||
Given POST upload a project file "<project_file>" to "project/import?option=<import_option>"
|
||||
Then the response status code should be 201
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "object"
|
||||
|
||||
|
||||
Examples:
|
||||
| project_file | import_option |
|
||||
| /home/wendy/processFiles/process1.pmx | create |
|
||||
@@ -116,7 +116,7 @@ abstract class Exporter
|
||||
? "" : serialize($workflowData["process"]['PRO_DYNAFORMS']);
|
||||
|
||||
$workflowData["process"] = array($workflowData["process"]);
|
||||
$workflowData["processCategory"] = empty($workflowData["processCategory"]) ? array() : $workflowData["processCategory"];
|
||||
$workflowData["processCategory"] = empty($workflowData["processCategory"]) ? array() : array($workflowData["processCategory"]);
|
||||
|
||||
|
||||
$data["bpmn-definition"] = $bpmnStruct;
|
||||
|
||||
@@ -117,7 +117,7 @@ class Project extends Api
|
||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||
|
||||
$httpStream->loadFromFile($outputFilename);
|
||||
$httpStream->setHeader("Content-Type", "application/$fileExtension");
|
||||
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||
$httpStream->send();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class CasesTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oCases = new \BusinessModel\Cases();
|
||||
$this->oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
<?php
|
||||
namespace Tests\ProcessMaker\Exporter;
|
||||
|
||||
use \ProcessMaker\Project;
|
||||
use \ProcessMaker\Exporter;
|
||||
|
||||
if (! class_exists("Propel")) {
|
||||
include_once __DIR__ . "/../../bootstrap.php";
|
||||
if (!class_exists("Propel")) {
|
||||
include_once(__DIR__ . "/../../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -16,10 +13,158 @@ if (! class_exists("Propel")) {
|
||||
*/
|
||||
class XmlExporterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testExport()
|
||||
protected static $exporter;
|
||||
protected static $projectUid = "";
|
||||
protected static $projectName = "";
|
||||
protected static $fileXml = "";
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$exporter = new Exporter\XmlExporter("4857540205310b25f3d51a5020772457");
|
||||
$exporter->build();
|
||||
$exporter->saveExport("/home/erik/out.xml");
|
||||
self::$projectName = \ProcessMaker\Util\Common::generateUID();
|
||||
|
||||
$json = "
|
||||
{
|
||||
\"prj_name\": \"" . self::$projectName . "\",
|
||||
\"prj_author\": \"00000000000000000000000000000001\",
|
||||
\"diagrams\": [
|
||||
{
|
||||
\"dia_uid\": \"\",
|
||||
\"activities\": [],
|
||||
\"events\": [],
|
||||
\"gateways\": [],
|
||||
\"flows\": [],
|
||||
\"artifacts\": [],
|
||||
\"laneset\": [],
|
||||
\"lanes\": []
|
||||
}
|
||||
]
|
||||
}
|
||||
";
|
||||
|
||||
$arrayResult = \ProcessMaker\Project\Adapter\BpmnWorkflow::createFromStruct(json_decode($json, true));
|
||||
|
||||
self::$projectUid = $arrayResult[0]["new_uid"];
|
||||
self::$fileXml = PATH_DOCUMENT . "output" . PATH_SEP . self::$projectUid . ".xml";
|
||||
|
||||
self::$exporter = new \ProcessMaker\Exporter\XmlExporter(self::$projectUid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete project
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$bpmnWf = \ProcessMaker\Project\Adapter\BpmnWorkflow::load(self::$projectUid);
|
||||
|
||||
$bpmnWf->remove();
|
||||
|
||||
unlink(self::$fileXml);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test export
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::export
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function testExport()
|
||||
{
|
||||
$strXml = self::$exporter->export();
|
||||
|
||||
$this->assertTrue(is_string($strXml));
|
||||
$this->assertNotEmpty($strXml);
|
||||
|
||||
return $strXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::build
|
||||
*
|
||||
* @depends testExport
|
||||
* @param string $strXml Data xml
|
||||
*/
|
||||
public function testBuild($strXml)
|
||||
{
|
||||
//DOMDocument
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadXML($strXml);
|
||||
|
||||
$nodeRoot = $doc->getElementsByTagName("ProcessMaker-Project")->item(0);
|
||||
$uid = "";
|
||||
|
||||
//Node meta
|
||||
$nodeMeta = $nodeRoot->getElementsByTagName("metadata")->item(0)->getElementsByTagName("meta");
|
||||
|
||||
$this->assertNotEmpty($nodeMeta);
|
||||
|
||||
foreach ($nodeMeta as $value) {
|
||||
$node = $value;
|
||||
|
||||
if ($node->hasAttribute("key") && $node->getAttribute("key") == "uid") {
|
||||
$uid = $node->nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(self::$projectUid, $uid);
|
||||
|
||||
//Node definition
|
||||
$nodeDefinition = $nodeRoot->getElementsByTagName("definition");
|
||||
|
||||
$this->assertNotEmpty($nodeDefinition);
|
||||
|
||||
foreach ($nodeDefinition as $value) {
|
||||
$node = $value;
|
||||
|
||||
if ($node->hasAttribute("class")) {
|
||||
$this->assertTrue(in_array($node->getAttribute("class"), array("BPMN", "workflow")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test saveExport
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::saveExport
|
||||
*/
|
||||
public function testSaveExport()
|
||||
{
|
||||
self::$exporter->saveExport(self::$fileXml);
|
||||
|
||||
$this->assertTrue(file_exists(self::$fileXml));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getTextNode
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::getTextNode
|
||||
*/
|
||||
public function testGetTextNode()
|
||||
{
|
||||
//Is not implemented. Method getTextNode() is private
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exception for invalid project uid
|
||||
*
|
||||
* @covers \ProcessMaker\Exporter\XmlExporter::__construct
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage Project "ProcessMaker\Project\Bpmn" with UID: 0, does not exist.
|
||||
*/
|
||||
public function test__constructExceptionInvalidProjectUid()
|
||||
{
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter("0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user