Merged in develop (pull request #7127)
Update with develop Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
@@ -53,7 +53,7 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
|
||||
'DEL_TASK_DUE_DATE' => $faker->dateTime(),
|
||||
'DEL_RISK_DATE' => $faker->dateTime(),
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process->id,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_DATA' => ''
|
||||
];
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,57 +5,66 @@
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(\ProcessMaker\Model\Process::class, function(Faker $faker) {
|
||||
/**
|
||||
* @todo Determine if we need more base columns populated
|
||||
*/
|
||||
$process = [
|
||||
// Return with default values
|
||||
return [
|
||||
'PRO_UID' => G::generateUniqueID(),
|
||||
'PRO_ID' => $faker->unique()->numberBetween(1, 200000),
|
||||
'PRO_TITLE' => $faker->sentence(3),
|
||||
'PRO_DESCRIPTION' => $faker->paragraph(3),
|
||||
'PRO_CREATE_USER' => '00000000000000000000000000000001',
|
||||
'PRO_DYNAFORMS' => '',
|
||||
'PRO_ITEE' => 1,
|
||||
'PRO_STATUS' => 'ACTIVE'
|
||||
'PRO_STATUS' => 'ACTIVE',
|
||||
'PRO_STATUS_ID' => 1,
|
||||
'PRO_TYPE_PROCESS' => 'PUBLIC',
|
||||
'PRO_UPDATE_DATE' => $faker->dateTime(),
|
||||
'PRO_CREATE_DATE' => $faker->dateTime(),
|
||||
'PRO_CATEGORY' => '',
|
||||
];
|
||||
});
|
||||
|
||||
$task1 = factory(\ProcessMaker\Model\Task::class)
|
||||
->create([
|
||||
'PRO_UID' => $process['PRO_UID'],
|
||||
'TAS_START'=>'TRUE'
|
||||
]);
|
||||
// Create a process with the foreign keys
|
||||
$factory->state(\ProcessMaker\Model\Process::class, 'foreign_keys', function (Faker $faker) {
|
||||
$user = factory(\ProcessMaker\Model\User::class)->create();
|
||||
return [
|
||||
'PRO_UID' => G::generateUniqueID(),
|
||||
'PRO_ID' => $faker->unique()->numberBetween(1, 200000),
|
||||
'PRO_TITLE' => $faker->sentence(3),
|
||||
'PRO_DESCRIPTION' => $faker->paragraph(3),
|
||||
'PRO_CREATE_USER' => $user->USR_UID,
|
||||
'PRO_DYNAFORMS' => '',
|
||||
'PRO_ITEE' => 1,
|
||||
'PRO_STATUS' => 'ACTIVE',
|
||||
'PRO_STATUS_ID' => 1,
|
||||
'PRO_TYPE_PROCESS' => 'PUBLIC',
|
||||
'PRO_UPDATE_DATE' => $faker->dateTime(),
|
||||
'PRO_CREATE_DATE' => $faker->dateTime(),
|
||||
'PRO_CATEGORY' => '',
|
||||
];
|
||||
});
|
||||
|
||||
$task2 = factory(\ProcessMaker\Model\Task::class)
|
||||
->create([
|
||||
'PRO_UID' => $process['PRO_UID'],
|
||||
]);
|
||||
|
||||
//routes
|
||||
factory(\ProcessMaker\Model\Route::class)
|
||||
->create([
|
||||
'PRO_UID' => $process['PRO_UID'],
|
||||
'TAS_UID' => $task2['TAS_UID'],
|
||||
'ROU_NEXT_TASK' => '-1',
|
||||
]);
|
||||
|
||||
factory(\ProcessMaker\Model\Route::class)
|
||||
->create([
|
||||
'PRO_UID' => $process['PRO_UID'],
|
||||
'TAS_UID' => $task1['TAS_UID'],
|
||||
'ROU_NEXT_TASK' => $task2['TAS_UID']
|
||||
]);
|
||||
|
||||
//User assignments
|
||||
factory(\ProcessMaker\Model\TaskUser::class)
|
||||
->create([
|
||||
'TAS_UID' => $task1['TAS_UID'],
|
||||
'USR_UID' => \ProcessMaker\Model\User::all()->random()->USR_UID
|
||||
]);
|
||||
|
||||
factory(\ProcessMaker\Model\TaskUser::class)
|
||||
->create([
|
||||
'TAS_UID' => $task2['TAS_UID'],
|
||||
'USR_UID' => \ProcessMaker\Model\User::all()->random()->USR_UID
|
||||
]);
|
||||
|
||||
return $process;
|
||||
});
|
||||
// Create a process related to the flow designer
|
||||
$factory->state(\ProcessMaker\Model\Process::class, 'flow', function (Faker $faker) {
|
||||
// Create values in the foreign key relations
|
||||
$user = factory(\ProcessMaker\Model\User::class)->create();
|
||||
$process = [
|
||||
'PRO_UID' => G::generateUniqueID(),
|
||||
'PRO_ID' => $faker->unique()->numberBetween(1, 200000),
|
||||
'PRO_TITLE' => $faker->sentence(3),
|
||||
'PRO_DESCRIPTION' => $faker->paragraph(3),
|
||||
'PRO_CREATE_USER' => $user->USR_UID,
|
||||
'PRO_DYNAFORMS' => '',
|
||||
'PRO_ITEE' => 1,
|
||||
'PRO_STATUS' => 'ACTIVE',
|
||||
'PRO_STATUS_ID' => 1,
|
||||
'PRO_TYPE_PROCESS' => 'PUBLIC',
|
||||
'PRO_UPDATE_DATE' => $faker->dateTime(),
|
||||
'PRO_CREATE_DATE' => $faker->dateTime(),
|
||||
'PRO_CATEGORY' => '',
|
||||
];
|
||||
// Create a task related to this process
|
||||
$task = factory(\ProcessMaker\Model\Task::class)->create([
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ use Faker\Generator as Faker;
|
||||
$factory->define(\ProcessMaker\Model\Task::class, function(Faker $faker) {
|
||||
return [
|
||||
'PRO_UID' => G::generateUniqueID(),
|
||||
'PRO_ID' => $faker->unique()->numberBetween(),
|
||||
'TAS_UID' => G::generateUniqueID(),
|
||||
'TAS_ID' => $faker->unique()->numberBetween(),
|
||||
'TAS_TITLE' => $faker->sentence(2),
|
||||
@@ -33,10 +34,10 @@ $factory->define(\ProcessMaker\Model\Task::class, function(Faker $faker) {
|
||||
|
||||
// Create a delegation with the foreign keys
|
||||
$factory->state(\ProcessMaker\Model\Task::class, 'foreign_keys', function (Faker $faker) {
|
||||
$process = factory(\ProcessMaker\Model\Process::class)->create();
|
||||
return [
|
||||
'PRO_UID' => function() {
|
||||
return $process = factory(\ProcessMaker\Model\Process::class)->create();
|
||||
},
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'TAS_UID' => G::generateUniqueID(),
|
||||
'TAS_ID' => $faker->unique()->numberBetween(1, 200000),
|
||||
'TAS_TITLE' => $faker->sentence(2),
|
||||
|
||||
@@ -544,6 +544,7 @@ class WebApplication
|
||||
|
||||
config(['app.timezone' => TIME_ZONE]);
|
||||
|
||||
// Define the language
|
||||
Bootstrap::setLanguage();
|
||||
|
||||
Bootstrap::LoadTranslationObject((defined("SYS_LANG")) ? SYS_LANG : "en");
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* defaultAjax.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
/*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
@@ -30,8 +6,6 @@ if (isset($_SESSION['CURRENT_PAGE_INITILIZATION'])) {
|
||||
eval($_SESSION['CURRENT_PAGE_INITILIZATION']);
|
||||
}
|
||||
|
||||
|
||||
// $json=new Services_JSON();
|
||||
if (!defined('XMLFORM_AJAX_PATH')) {
|
||||
define('XMLFORM_AJAX_PATH', PATH_XMLFORM);
|
||||
}
|
||||
@@ -63,11 +37,11 @@ $G_FORM->values = isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array
|
||||
$newValues = (Bootstrap::json_decode(urlDecode(stripslashes($_POST['fields']))));
|
||||
|
||||
if (isset($_POST['grid'])) {
|
||||
$_POST['row'] = (int)$_POST['row'];
|
||||
$_POST['row'] = (int) $_POST['row'];
|
||||
$aAux = array();
|
||||
|
||||
foreach ($newValues as $sKey => $newValue) {
|
||||
$newValue = (array)$newValue;
|
||||
$newValue = (array) $newValue;
|
||||
$aKeys = array_keys($newValue);
|
||||
if (count($aKeys) > 0) {
|
||||
$aValues = array();
|
||||
@@ -88,7 +62,7 @@ if (count($newValues) > 1 && isset($_POST['grid'])) {
|
||||
for ($r2 = 1; $r2 <= $_POST['row']; $r2++) {
|
||||
foreach ($values as $class => $value) {
|
||||
if ($class == $_POST['grid']) {
|
||||
$value = (array)$value;
|
||||
$value = (array) $value;
|
||||
$arrayK = $value[$r2];
|
||||
foreach ($arrayK as $key2 => $val) {
|
||||
$fieldBase[$r2][$key2] = is_array($val) ? $val[$key2] : $val;
|
||||
@@ -107,7 +81,7 @@ if (count($newValues) > 1 && isset($_POST['grid'])) {
|
||||
$dependentFields = array();
|
||||
$aux = array();
|
||||
for ($r = 0; $r < count($newValues); $r++) {
|
||||
$newValues[$r] = (array)$newValues[$r];
|
||||
$newValues[$r] = (array) $newValues[$r];
|
||||
$G_FORM->setValues($newValues[$r]);
|
||||
//Search dependent fields
|
||||
foreach ($newValues[$r] as $k => $v) {
|
||||
@@ -117,7 +91,11 @@ for ($r = 0; $r < count($newValues); $r++) {
|
||||
} else {
|
||||
foreach ($v[$_POST['row']] as $k1 => $v1) {
|
||||
$myDependentFields = subDependencies($k1, $G_FORM, $aux, $_POST['grid']);
|
||||
$_SESSION[$G_FORM->id][$_POST['grid']][$_POST['row']][$k1] = $v1;
|
||||
$_SESSION[$G_FORM->id][$_POST['grid']] = [
|
||||
$_POST['row'] => [
|
||||
$k1 => $v1
|
||||
]
|
||||
];
|
||||
$G_FORM->values[$_POST['grid']][$_POST['row']][$k1] = $v1;
|
||||
}
|
||||
}
|
||||
@@ -142,12 +120,12 @@ $G_FORM->values = $newForm;
|
||||
$arrayFieldSubDependent = array();
|
||||
|
||||
if (isset($_POST["grid"])) {
|
||||
$arrayField = (array)(Bootstrap::json_decode(urlDecode(stripslashes($_POST["fields"]))));
|
||||
$arrayField = (array) (Bootstrap::json_decode(urlDecode(stripslashes($_POST["fields"]))));
|
||||
$arrayDependentField = array();
|
||||
$ereg = null;
|
||||
|
||||
foreach ($arrayField as $fieldData) {
|
||||
$arrayAux = (array)($fieldData);
|
||||
$arrayAux = (array) ($fieldData);
|
||||
|
||||
foreach ($arrayAux as $index => $value) {
|
||||
$ereg = $ereg . (($ereg != null) ? "|" : null) . $index; //Concatenate field
|
||||
@@ -185,7 +163,7 @@ if (isset($_POST["grid"])) {
|
||||
//Completed all fields of the grid
|
||||
if (isset($_POST["grid"]) && isset($_POST["gridField"])) {
|
||||
//Completed all fields of the grid
|
||||
$arrayGridField = (array)(Bootstrap::json_decode(urldecode(stripslashes($_POST["gridField"]))));
|
||||
$arrayGridField = (array) (Bootstrap::json_decode(urldecode(stripslashes($_POST["gridField"]))));
|
||||
|
||||
foreach ($arrayGridField as $index => $value) {
|
||||
$G_FORM->values[$_POST["grid"]][$_POST["row"]][$index] = $value;
|
||||
|
||||
@@ -2616,22 +2616,37 @@ class Bootstrap
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Language
|
||||
* Set Language defined in HTTP_ACCEPT_LANGUAGE
|
||||
* Only will accept if the language defined exist in the list of Admin > Settings > Language
|
||||
*
|
||||
* @link https://wiki.processmaker.com/3.2/Languages#Installing_the_PO_File
|
||||
*/
|
||||
public static function setLanguage()
|
||||
{
|
||||
$acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])?$_SERVER['HTTP_ACCEPT_LANGUAGE']:'en';
|
||||
$acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : 'en';
|
||||
$langServer = $acceptLanguage;
|
||||
if (!defined('SYS_LANG')) {
|
||||
$Translations = new \Translation;
|
||||
$Translations = new Translation;
|
||||
// Get the translation uploaded in the system
|
||||
$translationsTable = $Translations->getTranslationEnvironments();
|
||||
$inLang = false;
|
||||
foreach ($translationsTable as $locale) {
|
||||
if ($locale['LOCALE'] == $acceptLanguage) {
|
||||
// Check if the language used was uploaded in the Language
|
||||
// The languages can defined like this : en, en-US (language-localization)
|
||||
// We need to validate if the language exist it does not matter the localization
|
||||
$langServer = $locale['LOCALE'];
|
||||
$language = explode('-', $langServer);
|
||||
$language = head($language);
|
||||
if ($language === $acceptLanguage) {
|
||||
$inLang = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$lang = $inLang?$acceptLanguage:'en';
|
||||
// Overwriting the language defined in the server
|
||||
// Example 1. Accept-Language = pt and langServer = pt-BR, result SYS_LANG = pt-BR
|
||||
// Example 2. Accept-Language = pt and langServer = pt, result SYS_LANG = pt
|
||||
// Example 3. Accept-Language = it and langServer = NONE, result SYS_LANG = en
|
||||
$lang = ($inLang) ? $langServer : 'en';
|
||||
define("SYS_LANG", $lang);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="false">
|
||||
<directory suffix=".php">./gulliver</directory>
|
||||
<directory suffix=".php">./workflow/engine/classes</directory>
|
||||
<directory suffix=".php">./workflow/engine/src</directory>
|
||||
</whitelist>
|
||||
|
||||
@@ -54,6 +54,8 @@ define('PATH_HTML', PATH_HOME . 'public_html/');
|
||||
define('PATH_SMARTY_C', PATH_TRUNK . '/shared/compiled/smarty/c');
|
||||
define('PATH_SMARTY_CACHE', PATH_TRUNK . '/shared/compiled/smarty/cache');
|
||||
define('PATH_THIRDPARTY', PATH_TRUNK . '/thirdparty/');
|
||||
define("URL_KEY", 'c0l0s40pt1mu59r1m3');
|
||||
define("PATH_XMLFORM", PATH_CORE . "xmlform" . PATH_SEP);
|
||||
|
||||
// Set Time Zone
|
||||
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int) (env('MAIN_SYSTEM_UTC_TIME_ZONE', 'workflow')) == 1;
|
||||
|
||||
6440
tests/resources/GranularImporterTest.json
Normal file
6440
tests/resources/GranularImporterTest.json
Normal file
File diff suppressed because it is too large
Load Diff
1347
tests/resources/p1normal-1.pmx
Normal file
1347
tests/resources/p1normal-1.pmx
Normal file
File diff suppressed because it is too large
Load Diff
156
tests/resources/p1normalWithException-1.pmx
Normal file
156
tests/resources/p1normalWithException-1.pmx
Normal file
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ProcessMaker-Project version="3.0">
|
||||
<metadata>
|
||||
<meta key="vendor_version"><![CDATA[(Branch bugfix/PMC-138)]]></meta>
|
||||
<meta key="vendor_version_code">Michelangelo</meta>
|
||||
<meta key="export_timestamp">1571948720</meta>
|
||||
<meta key="export_datetime"><![CDATA[2019-10-24T20:25:20+00:00]]></meta>
|
||||
<meta key="export_server_addr"><![CDATA[172.16.3.67:8091]]></meta>
|
||||
<meta key="export_server_os">Linux</meta>
|
||||
<meta key="export_server_php_version">70132</meta>
|
||||
<meta key="workspace">workflow</meta>
|
||||
<meta key="name">p1normalWithException</meta>
|
||||
<meta key="uid">8881455415db208a91cf144066685122</meta>
|
||||
</metadata>
|
||||
<definition class="BPMN">
|
||||
<table name="ACTIVITY"/>
|
||||
<table name="ARTIFACT"/>
|
||||
<table name="BOUND"/>
|
||||
<table name="DATA"/>
|
||||
<table name="DIAGRAM">
|
||||
<record>
|
||||
<dia_uid>8820979315db208a91fd6c8053956230</dia_uid>
|
||||
<prj_uid>8881455415db208a91cf144066685122</prj_uid>
|
||||
<dia_name>p1normalWithException</dia_name>
|
||||
<dia_is_closable>0</dia_is_closable>
|
||||
</record>
|
||||
</table>
|
||||
<table name="DOCUMENTATION"/>
|
||||
<table name="EVENT"/>
|
||||
<table name="EXTENSION"/>
|
||||
<table name="FLOW"/>
|
||||
<table name="GATEWAY"/>
|
||||
<table name="LANE"/>
|
||||
<table name="LANESET"/>
|
||||
<table name="PARTICIPANT"/>
|
||||
<table name="PROCESS">
|
||||
<record>
|
||||
<pro_uid>3930204045db208a92004a9028237855</pro_uid>
|
||||
<prj_uid>8881455415db208a91cf144066685122</prj_uid>
|
||||
<dia_uid>8820979315db208a91fd6c8053956230</dia_uid>
|
||||
<pro_name>p1normalWithException</pro_name>
|
||||
<pro_type>NONE</pro_type>
|
||||
<pro_is_executable>0</pro_is_executable>
|
||||
<pro_is_closed>0</pro_is_closed>
|
||||
<pro_is_subprocess>0</pro_is_subprocess>
|
||||
</record>
|
||||
</table>
|
||||
<table name="PROJECT">
|
||||
<record>
|
||||
<prj_uid>8881455415db208a91cf144066685122</prj_uid>
|
||||
<prj_name>p1normalWithException</prj_name>
|
||||
<prj_description></prj_description>
|
||||
<prj_target_namespace></prj_target_namespace>
|
||||
<prj_expresion_language></prj_expresion_language>
|
||||
<prj_type_language></prj_type_language>
|
||||
<prj_exporter></prj_exporter>
|
||||
<prj_exporter_version></prj_exporter_version>
|
||||
<prj_create_date><![CDATA[2019-10-24 20:25:13]]></prj_create_date>
|
||||
<prj_update_date></prj_update_date>
|
||||
<prj_author>6089564115db1b5c1377263061626288</prj_author>
|
||||
<prj_author_version></prj_author_version>
|
||||
<prj_original_source></prj_original_source>
|
||||
</record>
|
||||
</table>
|
||||
</definition>
|
||||
<definition class="workflow">
|
||||
<table name="process">
|
||||
<record>
|
||||
<pro_uid>8881455415db208a91cf144066685122</pro_uid>
|
||||
<pro_title>p1normalWithException</pro_title>
|
||||
<pro_description></pro_description>
|
||||
<pro_parent>8881455415db208a91cf144066685122</pro_parent>
|
||||
<pro_time>1</pro_time>
|
||||
<pro_timeunit>DAYS</pro_timeunit>
|
||||
<pro_status>ACTIVE</pro_status>
|
||||
<pro_status_id>1</pro_status_id>
|
||||
<pro_type_day></pro_type_day>
|
||||
<pro_type>NORMAL</pro_type>
|
||||
<pro_assignment>FALSE</pro_assignment>
|
||||
<pro_show_map>0</pro_show_map>
|
||||
<pro_show_message>0</pro_show_message>
|
||||
<pro_subprocess>0</pro_subprocess>
|
||||
<pro_tri_create></pro_tri_create>
|
||||
<pro_tri_open></pro_tri_open>
|
||||
<pro_tri_deleted></pro_tri_deleted>
|
||||
<pro_tri_canceled></pro_tri_canceled>
|
||||
<pro_tri_paused></pro_tri_paused>
|
||||
<pro_tri_reassigned></pro_tri_reassigned>
|
||||
<pro_tri_unpaused></pro_tri_unpaused>
|
||||
<pro_type_process>PUBLIC</pro_type_process>
|
||||
<pro_show_delegate>0</pro_show_delegate>
|
||||
<pro_show_dynaform>0</pro_show_dynaform>
|
||||
<pro_category></pro_category>
|
||||
<pro_sub_category></pro_sub_category>
|
||||
<pro_industry>0</pro_industry>
|
||||
<pro_update_date></pro_update_date>
|
||||
<pro_create_date><![CDATA[2019-10-24 20:25:13]]></pro_create_date>
|
||||
<pro_create_user>6089564115db1b5c1377263061626288</pro_create_user>
|
||||
<pro_height>5000</pro_height>
|
||||
<pro_width>10000</pro_width>
|
||||
<pro_title_x>0</pro_title_x>
|
||||
<pro_title_y>0</pro_title_y>
|
||||
<pro_debug>0</pro_debug>
|
||||
<pro_dynaforms></pro_dynaforms>
|
||||
<pro_derivation_screen_tpl></pro_derivation_screen_tpl>
|
||||
<pro_cost>0</pro_cost>
|
||||
<pro_unit_cost></pro_unit_cost>
|
||||
<pro_itee>1</pro_itee>
|
||||
<pro_action_done></pro_action_done>
|
||||
<category_id>0</category_id>
|
||||
<pro_category_label>No Category</pro_category_label>
|
||||
<pro_bpmn>1</pro_bpmn>
|
||||
</record>
|
||||
</table>
|
||||
<table name="tasks"/>
|
||||
<table name="routes"/>
|
||||
<table name="lanes"/>
|
||||
<table name="gateways"/>
|
||||
<table name="inputs"/>
|
||||
<table name="outputs"/>
|
||||
<table name="dynaforms"/>
|
||||
<table name="steps"/>
|
||||
<table name="triggers"/>
|
||||
<table name="taskusers"/>
|
||||
<table name="groupwfs"/>
|
||||
<table name="steptriggers"/>
|
||||
<table name="dbconnections"/>
|
||||
<table name="reportTables"/>
|
||||
<table name="reportTablesVars"/>
|
||||
<table name="stepSupervisor"/>
|
||||
<table name="objectPermissions"/>
|
||||
<table name="subProcess"/>
|
||||
<table name="caseTracker"/>
|
||||
<table name="caseTrackerObject"/>
|
||||
<table name="stage"/>
|
||||
<table name="fieldCondition"/>
|
||||
<table name="event"/>
|
||||
<table name="caseScheduler"/>
|
||||
<table name="processCategory"/>
|
||||
<table name="taskExtraProperties"/>
|
||||
<table name="processUser"/>
|
||||
<table name="processVariables"/>
|
||||
<table name="webEntry"/>
|
||||
<table name="webEntryEvent"/>
|
||||
<table name="messageType"/>
|
||||
<table name="messageTypeVariable"/>
|
||||
<table name="messageEventDefinition"/>
|
||||
<table name="scriptTask"/>
|
||||
<table name="timerEvent"/>
|
||||
<table name="emailEvent"/>
|
||||
<table name="filesManager"/>
|
||||
<table name="abeConfiguration"/>
|
||||
<table name="elementTask"/>
|
||||
</definition>
|
||||
<workflow-files/>
|
||||
</ProcessMaker-Project>
|
||||
457
tests/resources/p1normalWithoutTitle-1.pmx
Normal file
457
tests/resources/p1normalWithoutTitle-1.pmx
Normal file
File diff suppressed because it is too large
Load Diff
458
tests/resources/p1normalWithoutTitle2-1.pmx
Normal file
458
tests/resources/p1normalWithoutTitle2-1.pmx
Normal file
File diff suppressed because it is too large
Load Diff
58
tests/resources/p2custom-1-ObjectsToImport.json
Normal file
58
tests/resources/p2custom-1-ObjectsToImport.json
Normal file
@@ -0,0 +1,58 @@
|
||||
[
|
||||
{
|
||||
"id": "PROCESSDEFINITION",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "ASSIGNMENTRULES",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "VARIABLES",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "DYNAFORMS",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "INPUTDOCUMENTS",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "OUTPUTDOCUMENTS",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "TRIGGERS",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "REPORTTABLES",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "TEMPLATES",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "FILES",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "DBCONNECTION",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "PERMISSIONS",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "SUPERVISORS",
|
||||
"action": "replace"
|
||||
},
|
||||
{
|
||||
"id": "SUPERVISORSOBJECTS",
|
||||
"action": "replace"
|
||||
}
|
||||
]
|
||||
1332
tests/resources/p2custom-1.pmx2
Normal file
1332
tests/resources/p2custom-1.pmx2
Normal file
File diff suppressed because it is too large
Load Diff
210
tests/resources/projectData.json
Normal file
210
tests/resources/projectData.json
Normal file
@@ -0,0 +1,210 @@
|
||||
{
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"prj_name": "createBPMN",
|
||||
"prj_description": "test",
|
||||
"prj_target_namespace": "",
|
||||
"prj_expresion_language": "",
|
||||
"prj_type_language": "",
|
||||
"prj_exporter": "",
|
||||
"prj_exporter_version": "",
|
||||
"prj_create_date": "2019-10-30 14:30:01",
|
||||
"prj_update_date": "2019-10-30 14:30:10",
|
||||
"prj_author": "00000000000000000000000000000001",
|
||||
"prj_author_version": "",
|
||||
"prj_original_source": "",
|
||||
"prj_type": "NONE",
|
||||
"prj_category": "test",
|
||||
"pro_status": "ACTIVE",
|
||||
"diagrams": [
|
||||
{
|
||||
"dia_uid": "7012431415db99e69c064a1027112720",
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"dia_name": "createBPMN",
|
||||
"dia_is_closable": "0",
|
||||
"activities": [
|
||||
{
|
||||
"act_uid": "5165535925db99e72bcae07068945328",
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"pro_uid": "9258990045db99e69c08f67059175864",
|
||||
"act_name": "Task 1",
|
||||
"act_type": "TASK",
|
||||
"act_is_for_compensation": "0",
|
||||
"act_start_quantity": "1",
|
||||
"act_completion_quantity": "0",
|
||||
"act_task_type": "EMPTY",
|
||||
"act_implementation": "",
|
||||
"act_instantiate": "0",
|
||||
"act_script_type": "",
|
||||
"act_script": "",
|
||||
"act_loop_type": "EMPTY",
|
||||
"act_test_before": "0",
|
||||
"act_loop_maximum": "0",
|
||||
"act_loop_condition": "0",
|
||||
"act_loop_cardinality": "0",
|
||||
"act_loop_behavior": "0",
|
||||
"act_is_adhoc": "0",
|
||||
"act_is_collapsed": "0",
|
||||
"act_completion_condition": "0",
|
||||
"act_ordering": "0",
|
||||
"act_cancel_remaining_instances": "1",
|
||||
"act_protocol": "0",
|
||||
"act_method": "0",
|
||||
"act_is_global": "0",
|
||||
"act_referer": "0",
|
||||
"act_default_flow": "0",
|
||||
"act_master_diagram": "0",
|
||||
"bou_uid": "2584782805db99e72bd0980067403101",
|
||||
"dia_uid": "7012431415db99e69c064a1027112720",
|
||||
"element_uid": "5165535925db99e72bcae07068945328",
|
||||
"bou_element": "4022955515db99e6aef9528027473017",
|
||||
"bou_element_type": "bpmnActivity",
|
||||
"bou_x": "177",
|
||||
"bou_y": "79",
|
||||
"bou_width": "150",
|
||||
"bou_height": "75",
|
||||
"bou_rel_position": "0",
|
||||
"bou_size_identical": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
],
|
||||
"artifacts": [],
|
||||
"events": [
|
||||
{
|
||||
"evn_uid": "3038076035db99e72c3c135082812123",
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"pro_uid": "9258990045db99e69c08f67059175864",
|
||||
"evn_name": "",
|
||||
"evn_type": "END",
|
||||
"evn_marker": "EMPTY",
|
||||
"evn_is_interrupting": "1",
|
||||
"evn_attached_to": "",
|
||||
"evn_cancel_activity": "0",
|
||||
"evn_activity_ref": "",
|
||||
"evn_wait_for_completion": "0",
|
||||
"evn_error_name": "",
|
||||
"evn_error_code": "",
|
||||
"evn_escalation_name": "",
|
||||
"evn_escalation_code": "",
|
||||
"evn_condition": "",
|
||||
"evn_message": "",
|
||||
"evn_operation_name": "",
|
||||
"evn_operation_implementation_ref": "",
|
||||
"evn_time_date": "",
|
||||
"evn_time_cycle": "",
|
||||
"evn_time_duration": "",
|
||||
"evn_behavior": "THROW",
|
||||
"bou_uid": "1455533305db99e72c3fae0095171965",
|
||||
"dia_uid": "7012431415db99e69c064a1027112720",
|
||||
"element_uid": "3038076035db99e72c3c135082812123",
|
||||
"bou_element": "4022955515db99e6aef9528027473017",
|
||||
"bou_element_type": "bpmnEvent",
|
||||
"bou_x": "365",
|
||||
"bou_y": "100",
|
||||
"bou_width": "33",
|
||||
"bou_height": "33",
|
||||
"bou_rel_position": "0",
|
||||
"bou_size_identical": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"evn_uid": "5511258545db99e72c29944076205232",
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"pro_uid": "9258990045db99e69c08f67059175864",
|
||||
"evn_name": "",
|
||||
"evn_type": "START",
|
||||
"evn_marker": "EMPTY",
|
||||
"evn_is_interrupting": "1",
|
||||
"evn_attached_to": "",
|
||||
"evn_cancel_activity": "0",
|
||||
"evn_activity_ref": "",
|
||||
"evn_wait_for_completion": "0",
|
||||
"evn_error_name": "",
|
||||
"evn_error_code": "",
|
||||
"evn_escalation_name": "",
|
||||
"evn_escalation_code": "",
|
||||
"evn_condition": "",
|
||||
"evn_message": "LEAD",
|
||||
"evn_operation_name": "",
|
||||
"evn_operation_implementation_ref": "",
|
||||
"evn_time_date": "",
|
||||
"evn_time_cycle": "",
|
||||
"evn_time_duration": "",
|
||||
"evn_behavior": "CATCH",
|
||||
"bou_uid": "7732258935db99e72c2e3a3068518403",
|
||||
"dia_uid": "7012431415db99e69c064a1027112720",
|
||||
"element_uid": "5511258545db99e72c29944076205232",
|
||||
"bou_element": "4022955515db99e6aef9528027473017",
|
||||
"bou_element_type": "bpmnEvent",
|
||||
"bou_x": "100",
|
||||
"bou_y": "100",
|
||||
"bou_width": "33",
|
||||
"bou_height": "33",
|
||||
"bou_rel_position": "0",
|
||||
"bou_size_identical": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
],
|
||||
"flows": [
|
||||
{
|
||||
"flo_uid": "6368397865db99e72c52903064569710",
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"dia_uid": "7012431415db99e69c064a1027112720",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": " ",
|
||||
"flo_element_origin": "5511258545db99e72c29944076205232",
|
||||
"flo_element_origin_type": "bpmnEvent",
|
||||
"flo_element_origin_port": "0",
|
||||
"flo_element_dest": "5165535925db99e72bcae07068945328",
|
||||
"flo_element_dest_type": "bpmnActivity",
|
||||
"flo_element_dest_port": "0",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "133",
|
||||
"flo_y1": "117",
|
||||
"flo_x2": "177",
|
||||
"flo_y2": "117",
|
||||
"flo_state": "[{\"x\":133,\"y\":117},{\"x\":177,\"y\":117}]",
|
||||
"flo_position": "1"
|
||||
},
|
||||
{
|
||||
"flo_uid": "7620102575db99e72c53873033338002",
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"dia_uid": "7012431415db99e69c064a1027112720",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": " ",
|
||||
"flo_element_origin": "5165535925db99e72bcae07068945328",
|
||||
"flo_element_origin_type": "bpmnActivity",
|
||||
"flo_element_origin_port": "0",
|
||||
"flo_element_dest": "3038076035db99e72c3c135082812123",
|
||||
"flo_element_dest_type": "bpmnEvent",
|
||||
"flo_element_dest_port": "0",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "328",
|
||||
"flo_y1": "117",
|
||||
"flo_x2": "365",
|
||||
"flo_y2": "117",
|
||||
"flo_state": "[{\"x\":328,\"y\":117},{\"x\":365,\"y\":117}]",
|
||||
"flo_position": "1"
|
||||
}
|
||||
],
|
||||
"gateways": [],
|
||||
"data": [],
|
||||
"participants": [],
|
||||
"laneset": [],
|
||||
"lanes": []
|
||||
}
|
||||
],
|
||||
"process": {
|
||||
"pro_uid": "9258990045db99e69c08f67059175864",
|
||||
"prj_uid": "3139884745db99e69bd2683082492802",
|
||||
"dia_uid": "7012431415db99e69c064a1027112720",
|
||||
"pro_name": "createBPMN",
|
||||
"pro_type": "NONE",
|
||||
"pro_is_executable": "0",
|
||||
"pro_is_closed": "0",
|
||||
"pro_is_subprocess": "0",
|
||||
"pro_id": "2",
|
||||
"pro_status": "ACTIVE"
|
||||
}
|
||||
}
|
||||
457
tests/resources/saveAsTest-1.pmx
Normal file
457
tests/resources/saveAsTest-1.pmx
Normal file
File diff suppressed because it is too large
Load Diff
8
tests/resources/simpleClassicPostData.json
Normal file
8
tests/resources/simpleClassicPostData.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"function": "reloadField",
|
||||
"form": "Wlp0bHBXS2tiR2FtcVpXaHBwbHcxV09tWlpObHBXaWphV2locDJpbHEyWm9wV1dlWkpabG4yQ2phWlNrcFpXbTFteHNvcGJSbUp0Z29tQ21iR1drcTJmTTZhS3BvbMKwbG9NOA______",
|
||||
"fields": "[%7B%22suggest2%22%3A%22C%22%7D]",
|
||||
"grid": "Grid",
|
||||
"gridField": "%7B%22suggest1%22%3A%22BO%22%7D",
|
||||
"row": "1"
|
||||
}
|
||||
242
tests/resources/simpleClassicSessionData.json
Normal file
242
tests/resources/simpleClassicSessionData.json
Normal file
File diff suppressed because one or more lines are too long
15
tests/resources/simpleClassicXmlFormData.xml
Executable file
15
tests/resources/simpleClassicXmlFormData.xml
Executable file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dynaForm type="xmlform" name="2859218665d41d7c2920598058137861/3411353005d41d9a730ede8060385476" width="500" enabletemplate="0" mode="" nextstepsave="prompt">
|
||||
<BUG type="title" required="0" readonly="0" optgroup="0">
|
||||
<en>BUG</en>
|
||||
</BUG>
|
||||
<TEST type="text" maxlength="64" validate="Any" required="0" readonly="0" size="15" mode="edit" optgroup="0">
|
||||
<en>TEST</en>
|
||||
</TEST>
|
||||
<SUGGEST type="suggest" required="0" size="15" mode="edit" sqlconnection="4898432885d41d9921cea61001765691" maxresults="6" searchtype="*searchtype*" table="0" readonly="0" optgroup="0"><![CDATA[SELECT IC_UID, IC_NAME
|
||||
FROM ISO_COUNTRY]]><en>SUGGEST</en></SUGGEST>
|
||||
<SUBMIT type="submit" required="0" readonly="0" optgroup="0">
|
||||
<en>SUBMIT</en>
|
||||
</SUBMIT>
|
||||
<Grid type="grid" xmlgrid="2859218665d41d7c2920598058137861/4923800155da71a732a4207031768424" addrow="1" deleterow="1" required="0" readonly="0" resizable="0" optgroup="0"/>
|
||||
</dynaForm>
|
||||
47
tests/unit/gulliver/methods/DefaultAjaxTest.php
Normal file
47
tests/unit/gulliver/methods/DefaultAjaxTest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\gulliver\methods;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class DefaultAjaxTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* This gets data from a json file.
|
||||
* @param string $pathData
|
||||
* @return array
|
||||
*/
|
||||
private function getDataFromFile(string $pathData): array
|
||||
{
|
||||
$pathData = PATH_TRUNK . "/tests/resources/{$pathData}";
|
||||
$data = file_get_contents($pathData);
|
||||
$result = json_decode($data, JSON_OBJECT_AS_ARRAY);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This should get the data for control suggest in classic process.
|
||||
* @test
|
||||
*/
|
||||
public function this_should_get_the_data_for_control_suggest_in_classic_process()
|
||||
{
|
||||
$_POST = $this->getDataFromFile("simpleClassicPostData.json");
|
||||
$_SESSION = $this->getDataFromFile("simpleClassicSessionData.json");
|
||||
$_SESSION["CURRENT_PAGE_INITILIZATION"] = "";
|
||||
|
||||
$pathName = PATH_XMLFORM . "2859218665d41d7c2920598058137861";
|
||||
$pathFileName = "{$pathName}/3411353005d41d9a730ede8060385476_tmp0.xml";
|
||||
if (!is_dir($pathName)) {
|
||||
mkdir($pathName);
|
||||
}
|
||||
$data = file_get_contents(PATH_TRUNK . "/tests/resources/simpleClassicXmlFormData.xml");
|
||||
file_put_contents($pathFileName, $data);
|
||||
|
||||
require_once PATH_TRUNK . '/gulliver/methods/defaultAjax.php';
|
||||
$this->expectOutputString('[]');
|
||||
|
||||
unlink($pathFileName);
|
||||
rmdir($pathName);
|
||||
}
|
||||
}
|
||||
83
tests/unit/workflow/engine/classes/DerivationTest.php
Normal file
83
tests/unit/workflow/engine/classes/DerivationTest.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\classes;
|
||||
|
||||
use \Derivation;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DerivationTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Call the setUp parent method
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getSubProcessVariables method with object variables
|
||||
*
|
||||
* @covers Derivation::getSubProcessVariables()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_the_get_sub_process_variables_method_with_object_variables()
|
||||
{
|
||||
$fields = ['@&var2' => '@&var3'];
|
||||
$childCaseData = ['var2' => (object)['Street' => 'test', 'name' => 'Something']];
|
||||
$parentCaseData = ['var1' => (object)['Street' => 'test']];
|
||||
|
||||
$der = new Derivation();
|
||||
$res = $der->getSubProcessVariables($fields, $childCaseData, $parentCaseData);
|
||||
|
||||
$this->assertArrayHasKey('var3', $res);
|
||||
$this->assertObjectHasAttribute('Street', $res['var3']);
|
||||
$this->assertObjectHasAttribute('name', $res['var3']);
|
||||
$this->assertEquals($res['var3'], (object)['Street' => 'test', 'name' => 'Something']);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getSubProcessVariables method with origin labels
|
||||
*
|
||||
* @covers Derivation::getSubProcessVariables()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_the_get_sub_process_variables_method_with_origin_labels()
|
||||
{
|
||||
$fields = ['@&var2' => '@&var3', '@&var2_label' => '@&var3'];
|
||||
$childCaseData = [
|
||||
'var2' => (object)['Street' => 'test', 'name' => 'Something'],
|
||||
'var2_label' => ['Street' => 'test', 'name' => 'Something']
|
||||
];
|
||||
$parentCaseData = ['var1' => (object)['Street' => 'test']];
|
||||
|
||||
$der = new Derivation();
|
||||
$res = $der->getSubProcessVariables($fields, $childCaseData, $parentCaseData);
|
||||
|
||||
$this->assertArrayHasKey('var3_label', $res);
|
||||
$this->assertEquals($res['var3_label'], ['Street' => 'test', 'name' => 'Something']);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getSubProcessVariables method with target labels
|
||||
*
|
||||
* @covers Derivation::getSubProcessVariables()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_the_get_sub_process_variables_method_with_target_labels()
|
||||
{
|
||||
$fields = ['@&var2' => '@&var3', '@&var2' => '@&var3_label'];
|
||||
$childCaseData = ['var2' => (object)['Street' => 'test', 'name' => 'Something']];
|
||||
$parentCaseData = ['var1' => (object)['Street' => 'test']];
|
||||
|
||||
$der = new Derivation();
|
||||
$res = $der->getSubProcessVariables($fields, $childCaseData, $parentCaseData);
|
||||
|
||||
$this->assertArrayHasKey('var3_label', $res);
|
||||
$this->assertObjectHasAttribute('Street', $res['var3_label']);
|
||||
$this->assertObjectHasAttribute('name', $res['var3_label']);
|
||||
$this->assertEquals($res['var3_label'], (object)['Street' => 'test', 'name' => 'Something']);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Faker\Factory;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\Model\Dynaform;
|
||||
use ProcessMaker\Model\Process;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class PmDynaformTest
|
||||
*
|
||||
* @coversDefaultClass PmDynaform
|
||||
*/
|
||||
class PmDynaformTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -239,7 +245,7 @@ class PmDynaformTest extends TestCase
|
||||
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => G::generateUniqueID()]);
|
||||
$pmDynaform->getDynaform();
|
||||
|
||||
$this->assertEquals(null, $pmDynaform->langs);
|
||||
$this->assertEquals(null, $pmDynaform->translations);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -824,4 +830,136 @@ class PmDynaformTest extends TestCase
|
||||
$this->assertFalse($jsonData->dataSchema[$key][4]['defined']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Review if the set translations are working correctly
|
||||
* If the translation does not exit needs to return null
|
||||
*
|
||||
* @covers PmDynaform::setTranslations()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_set_the_translations_if_exist()
|
||||
{
|
||||
// Create a form without translations defined
|
||||
$arrayForm = $this->createArrayDynaform();
|
||||
$form = factory(Dynaform::class)->create([
|
||||
'DYN_UID' => $arrayForm['items'][0]['id'],
|
||||
'DYN_CONTENT' => G::json_encode($arrayForm)
|
||||
]);
|
||||
$pmDynaform = new PmDynaform([]);
|
||||
$pmDynaform->setTranslations($form->DYN_UID);
|
||||
$this->assertNull($pmDynaform->translations);
|
||||
|
||||
// Create a form with translations defined
|
||||
$arrayForm = $this->createArrayDynaform();
|
||||
$form = factory(Dynaform::class)->states('translations')->create([
|
||||
'DYN_UID' => $arrayForm['items'][0]['id'],
|
||||
'DYN_CONTENT' => G::json_encode($arrayForm)
|
||||
]);
|
||||
$pmDynaform = new PmDynaform([]);
|
||||
$pmDynaform->setTranslations($form->DYN_UID);
|
||||
$this->assertNotNull($pmDynaform->translations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Review if the get labels from a specific language is working
|
||||
* If the translation defined does not have the specific language will return null
|
||||
*
|
||||
* @covers PmDynaform::getLabelsPo()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_get_label_from_translation()
|
||||
{
|
||||
$arrayForm = $this->createArrayDynaform();
|
||||
// Create a translations related to ["es", "es-Es"]
|
||||
$form = factory(Dynaform::class)->states('translations')->create([
|
||||
'DYN_UID' => $arrayForm['items'][0]['id'],
|
||||
'DYN_CONTENT' => G::json_encode($arrayForm)
|
||||
]);
|
||||
$pmDynaform = new PmDynaform([]);
|
||||
$pmDynaform->setTranslations($form->DYN_UID);
|
||||
$labelsPo = $pmDynaform->getLabelsPo('es');
|
||||
$this->assertNotNull($labelsPo);
|
||||
$labelsPo = $pmDynaform->getLabelsPo('es-Es');
|
||||
$this->assertNotNull($labelsPo);
|
||||
$faker = Factory::create();
|
||||
$labelsPo = $pmDynaform->getLabelsPo($faker->sentence(1));
|
||||
$this->assertNull($labelsPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Review if the SQL that uses the SELECT statement is parsed correctly
|
||||
*
|
||||
* @covers PmDynaform::sqlParse()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_get_sql_parsed_select_statement()
|
||||
{
|
||||
// Note.- The following queries are used by running tests but none of them are valid
|
||||
$sqlOriginal1 = 'SELECT TOP 10 USERS.USR_UID, USERS.USR_ID, USERS.USR_USERNAME AS USERNAME, MAX(RBAC_USERS_ROLES.ROL_UID),
|
||||
MIN(RBAC_USERS_ROLES.ROL_UID) AS THEMIN, (SELECT USR_FIRSTNAME FROM USERS), (SELECT USR_LASTNAME AS XXX) AS YYY, <>, 1000
|
||||
FROM USERS AS OFFSET INNER JOIN RBAC_USERS ON USERS.USR_UID = RBAC_USERS.USR_UID INNER JOIN RBAC_USERS_ROLES ON
|
||||
USERS.USR_UID = RBAC_USERS_ROLES.USR_UID WHERE USERS.USR_UID <> "" AND 1 AND OFFSET 1 GROUP BY USERS.USR_UID HAVING
|
||||
USERS.USR_UID <> "" ORDER BY USERS.USR_ID DESC LIMIT 1 OFFSET 10 FOR UPDATE';
|
||||
|
||||
$sqlOriginal2 = 'SELECT TOP 10 USERS.USR_UID, USERS.USR_ID, USERS.USR_USERNAME AS USERNAME, MAX(RBAC_USERS_ROLES.ROL_UID),
|
||||
MIN(RBAC_USERS_ROLES.ROL_UID) AS THEMIN, (SELECT USR_FIRSTNAME FROM USERS), (SELECT USR_LASTNAME AS XXX) AS YYY, <>, 1000
|
||||
FROM USERS INNER JOIN RBAC_USERS ON USERS.USR_UID = RBAC_USERS.USR_UID INNER JOIN RBAC_USERS_ROLES ON
|
||||
USERS.USR_UID = RBAC_USERS_ROLES.USR_UID WHERE USERS.USR_UID <> "" AND 1 GROUP BY USERS.USR_UID HAVING
|
||||
USERS.USR_UID <> "" ORDER BY USERS.USR_ID DESC LIMIT 1, 10 FOR UPDATE';
|
||||
|
||||
$sqlOriginal3 = 'DUMMY';
|
||||
|
||||
// Instance the class PmDynaform
|
||||
$pmDynaform = new PmDynaform([]);
|
||||
|
||||
// Test bug PMC-1299
|
||||
$sqlParsed1 = $pmDynaform->sqlParse($sqlOriginal1);
|
||||
$this->assertFalse(strpos($sqlParsed1, 'INNER INNER'));
|
||||
|
||||
// For now is only used for complete the coverture
|
||||
$sqlParsed2 = $pmDynaform->sqlParse($sqlOriginal2, 'dummy_function_for_this_unit_test');
|
||||
// To Do: Currently, there is a coverture of 100%, but is necessary to add more tests to verify
|
||||
// if the SQL string is parsed correctly in more scenarios
|
||||
|
||||
// Test another string, shoul be return the same value
|
||||
$sqlParsed3 = $pmDynaform->sqlParse($sqlOriginal3);
|
||||
$this->assertEquals($sqlOriginal3, $sqlParsed3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Review if the SQL that uses the CALL statement is parsed correctly
|
||||
*
|
||||
* @covers PmDynaform::sqlParse()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_get_sql_parsed_call_statement()
|
||||
{
|
||||
$sqlOriginal = 'CALL dummy_sp_for_this_unit_test()';
|
||||
|
||||
$pmDynaform = new PmDynaform([]);
|
||||
$sqlParsed = $pmDynaform->sqlParse($sqlOriginal);
|
||||
|
||||
$this->assertEquals(strlen($sqlOriginal), strlen($sqlParsed));
|
||||
}
|
||||
|
||||
/**
|
||||
* Review if the SQL that uses the EXECUTE statement is parsed correctly
|
||||
*
|
||||
* @covers PmDynaform::sqlParse()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_get_sql_parsed_execute_statement()
|
||||
{
|
||||
$sqlOriginal = 'EXECUTE dummy_sp_for_this_unit_test()';
|
||||
|
||||
$pmDynaform = new PmDynaform([]);
|
||||
$sqlParsed = $pmDynaform->sqlParse($sqlOriginal);
|
||||
|
||||
$this->assertEquals(strlen($sqlOriginal), strlen($sqlParsed));
|
||||
}
|
||||
}
|
||||
|
||||
// Dummy function used for the coverture
|
||||
function dummy_function_for_this_unit_test()
|
||||
{
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
28
tests/unit/workflow/engine/classes/PmTableTest.php
Normal file
28
tests/unit/workflow/engine/classes/PmTableTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class PmTablesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Check if the "removePmtPropelFolder" is working correctly
|
||||
*
|
||||
* @covers PmTable::removePmtPropelFolder()
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function it_should_check_remove_pmt_propel_folder()
|
||||
{
|
||||
// Define the folder path
|
||||
$pmtPropelFolderPath = PATH_DB . config('system.workspace') . PATH_SEP . 'pmt-propel';
|
||||
|
||||
// Create the folder
|
||||
G::mk_dir($pmtPropelFolderPath);
|
||||
|
||||
// Remove the "pmt-propel" folder
|
||||
PmTable::removePmtPropelFolder();
|
||||
|
||||
// Assert that the folder was deleted correctly
|
||||
$this->assertFalse(is_dir($pmtPropelFolderPath));
|
||||
}
|
||||
}
|
||||
@@ -428,4 +428,35 @@ class ProcessesTest extends TestCase
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the data structure of a project.
|
||||
* @test
|
||||
* @covers Processes::getWorkflowData()
|
||||
*/
|
||||
public function it_should_get_workflow_data()
|
||||
{
|
||||
/**
|
||||
* To perform the test this requires a valid installation and its respective license.
|
||||
*
|
||||
* In the file "workflow/engine/classes/WorkspaceTools.php",
|
||||
* these lines need the db.php file.
|
||||
*
|
||||
* public function __construct($workspaceName)
|
||||
* {
|
||||
* $this->name = $workspaceName;
|
||||
* $this->path = PATH_DB . $this->name;
|
||||
* $this->dbPath = $this->path . '/db.php';
|
||||
* if ($this->workspaceExists()) {
|
||||
* $this->getDBInfo();
|
||||
* }
|
||||
* $this->setListContentMigrateTable();
|
||||
* }
|
||||
*/
|
||||
$this->markTestIncomplete("To perform the test this requires a valid installation and its respective license.");
|
||||
$process = factory(\ProcessMaker\Model\Process::class)->create();
|
||||
$processes = new Processes();
|
||||
$result = $processes->getWorkflowData($process->PRO_UID);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class DesignerTest extends TestCase
|
||||
);
|
||||
|
||||
//Start the session for the user logged
|
||||
session_start();
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$_SESSION['CASE'] = $application->APP_NUMBER;
|
||||
$_SESSION['PIN'] = "LJ5W";
|
||||
|
||||
@@ -205,4 +205,53 @@ class ActionsByEmailTest extends TestCase
|
||||
//Assert the email was not sent
|
||||
$this->assertContains('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the forwardMail method with ssl
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\ActionsByEmail::forwardMail()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_the_forward_mail_method_with_ssl()
|
||||
{
|
||||
//Create the Task factory
|
||||
factory(Task::class)->create();
|
||||
//Create the Process factory
|
||||
factory(Process::class)->create();
|
||||
//Create the Dynaform factory
|
||||
factory(Dynaform::class)->create();
|
||||
//Create the EmailServerModel factory with smtp secure
|
||||
factory(EmailServerModel::class)->create(
|
||||
['SMTPSECURE' => 'ssl']
|
||||
);
|
||||
//Create the Application factory
|
||||
factory(Application::class)->create();
|
||||
//Create the Delegation factory
|
||||
$delegation = factory(Delegation::class)->create();
|
||||
//Create the AbeConfiguration factory
|
||||
$abeConfiguration = factory(AbeConfiguration::class)->create();
|
||||
//Create the AbeConfiguration factory
|
||||
$abeRequest = factory(AbeRequest::class)->create([
|
||||
'ABE_UID' => $abeConfiguration->ABE_UID,
|
||||
'APP_UID' => $delegation->APP_UID,
|
||||
'DEL_INDEX' => $delegation->DEL_INDEX,
|
||||
'ABE_REQ_UID' => $abeConfiguration->ABE_UID,
|
||||
]);
|
||||
|
||||
//Prepare the array send to the method
|
||||
$arrayData = [
|
||||
'action' => 'forwardMail',
|
||||
'REQ_UID' => $abeRequest->ABE_REQ_UID,
|
||||
'limit' => '',
|
||||
'start' => ''
|
||||
];
|
||||
|
||||
//Create the ActionsByEmail object
|
||||
$abe = new ActionsByEmail();
|
||||
//Call the forwardMail method
|
||||
$res = $abe->forwardMail($arrayData);
|
||||
|
||||
//Assert the email was sent successfully
|
||||
$this->assertContains('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel;
|
||||
|
||||
use ProcessMaker\BusinessModel\Migrator\GranularImporter;
|
||||
use Tests\TestCase;
|
||||
|
||||
class GranularImporterTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* This returns a set of data that is read from a json file.
|
||||
*/
|
||||
public function importDataObject()
|
||||
{
|
||||
$filename = PATH_TRUNK . "/tests/resources/GranularImporterTest.json";
|
||||
$json = file_get_contents($filename);
|
||||
$data = json_decode($json, true);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* It should return data from addObjectData() method.
|
||||
* @test
|
||||
* @covers \ProcessMaker\BusinessModel\Migrator\GranularImporter::addObjectData()
|
||||
* @dataProvider importDataObject
|
||||
*/
|
||||
public function it_should_return_data_from_add_object_data_method($name, $data)
|
||||
{
|
||||
$granularImporter = new GranularImporter();
|
||||
$result = $granularImporter->addObjectData($name, $data);
|
||||
$this->assertArrayHasKey($name, $result);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user