PMCORE-3971 (remove conflicts with develop branch) 3.8.x: Solve the conflicts to merge this epic into develop

This commit is contained in:
Roly Gutierrez
2022-09-13 11:00:37 -04:00
parent b8b9722374
commit bfe9297e04
5 changed files with 1991 additions and 2613 deletions

4081
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,34 +1,22 @@
<?php <?php
namespace Database\Factories; use Faker\Generator as Faker;
use App\Factories\Factory; $factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
use Illuminate\Support\Str; $user = factory(\ProcessMaker\Model\User::class)->create();
$process = factory(\ProcessMaker\Model\Process::class)->create();
class DelegationFactory extends Factory $task = factory(\ProcessMaker\Model\Task::class)->create([
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$user = \ProcessMaker\Model\User::factory()->create();
$process = \ProcessMaker\Model\Process::factory()->create();
$task = \ProcessMaker\Model\Task::factory()->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID 'PRO_ID' => $process->PRO_ID
]); ]);
$application = \ProcessMaker\Model\Application::factory()->create([ $application = factory(\ProcessMaker\Model\Application::class)->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID, 'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID 'APP_CUR_USER' => $user->USR_UID
]); ]);
// Return with default values // Return with default values
return [ return [
'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), 'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID, 'APP_UID' => $application->APP_UID,
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'APP_NUMBER' => $application->APP_NUMBER, 'APP_NUMBER' => $application->APP_NUMBER,
@@ -39,53 +27,49 @@ class DelegationFactory extends Factory
'DEL_TYPE' => 'NORMAL', 'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1, 'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'DEL_THREAD_STATUS_ID' => 1,
'DEL_PRIORITY' => 3, 'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $this->faker->dateTime(), 'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_INIT_DATE' => $this->faker->dateTime(), 'DEL_INIT_DATE' => $faker->dateTime(),
'DEL_TASK_DUE_DATE' => $this->faker->dateTime(), 'DEL_TASK_DUE_DATE' => $faker->dateTime(),
'DEL_RISK_DATE' => $this->faker->dateTime(), 'DEL_RISK_DATE' => $faker->dateTime(),
'DEL_LAST_INDEX' => 0, 'DEL_LAST_INDEX' => 0,
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID, 'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '', 'DEL_DATA' => '',
'DEL_TITLE' => $this->faker->word() 'DEL_TITLE' => $faker->word()
]; ];
} });
/** // Create a delegation with the foreign keys
* Create a delegation with the foreign keys $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function (Faker $faker) {
* @return type
*/
public function foreign_keys()
{
$state = function (array $attributes) {
// Create values in the foreign key relations // Create values in the foreign key relations
$user = \ProcessMaker\Model\User::factory()->create(); $user = factory(\ProcessMaker\Model\User::class)->create();
$category = \ProcessMaker\Model\ProcessCategory::factory()->create(); $category = factory(\ProcessMaker\Model\ProcessCategory::class)->create();
$process = \ProcessMaker\Model\Process::factory()->create([ $process = factory(\ProcessMaker\Model\Process::class)->create([
'PRO_CATEGORY' => $category->CATEGORY_UID, 'PRO_CATEGORY' => $category->CATEGORY_UID,
'CATEGORY_ID' => $category->CATEGORY_ID 'CATEGORY_ID' => $category->CATEGORY_ID
]); ]);
$task = \ProcessMaker\Model\Task::factory()->create([ $task = factory(\ProcessMaker\Model\Task::class)->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID 'PRO_ID' => $process->PRO_ID
]); ]);
$application = \ProcessMaker\Model\Application::factory()->create([ $application = factory(\ProcessMaker\Model\Application::class)->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID, 'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID 'APP_CUR_USER' => $user->USR_UID
]); ]);
$delegateDate = $this->faker->dateTime(); $delegateDate = $faker->dateTime();
$initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes'); $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day'); $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day'); $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
$index = $this->faker->unique()->numberBetween(2000); $index = $faker->unique()->numberBetween(2000);
// Return with default values // Return with default values
return [ return [
'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), 'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID, 'APP_UID' => $application->APP_UID,
'DEL_INDEX' => $index, 'DEL_INDEX' => $index,
'APP_NUMBER' => $application->APP_NUMBER, 'APP_NUMBER' => $application->APP_NUMBER,
@@ -96,6 +80,7 @@ class DelegationFactory extends Factory
'DEL_TYPE' => 'NORMAL', 'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1, 'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'DEL_THREAD_STATUS_ID' => 1,
'DEL_PRIORITY' => 3, 'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $delegateDate, 'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INIT_DATE' => $initDate, 'DEL_INIT_DATE' => $initDate,
@@ -106,31 +91,24 @@ class DelegationFactory extends Factory
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID, 'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '', 'DEL_DATA' => '',
'DEL_TITLE' => $this->faker->word() 'DEL_TITLE' => $faker->word()
]; ];
}; });
return $this->state($state);
}
/** // Create a delegation with the foreign keys
* Create a delegation with the foreign keys $factory->state(\ProcessMaker\Model\Delegation::class, 'web_entry', function (Faker $faker) {
* @return type
*/
public function web_entry()
{
$state = function (array $attributes) {
// Create values in the foreign key relations // Create values in the foreign key relations
$user = \ProcessMaker\Model\User::factory()->create(); $user = factory(\ProcessMaker\Model\User::class)->create();
$category = \ProcessMaker\Model\ProcessCategory::factory()->create(); $category = factory(\ProcessMaker\Model\ProcessCategory::class)->create();
$process = \ProcessMaker\Model\Process::factory()->create([ $process = factory(\ProcessMaker\Model\Process::class)->create([
'PRO_CATEGORY' => $category->CATEGORY_UID, 'PRO_CATEGORY' => $category->CATEGORY_UID,
'CATEGORY_ID' => $category->CATEGORY_ID 'CATEGORY_ID' => $category->CATEGORY_ID
]); ]);
$task = \ProcessMaker\Model\Task::factory()->create([ $task = factory(\ProcessMaker\Model\Task::class)->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID 'PRO_ID' => $process->PRO_ID
]); ]);
$application = \ProcessMaker\Model\Application::factory()->web_entry()->create([ $application = factory(\ProcessMaker\Model\Application::class)->states('web_entry')->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID, 'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID 'APP_CUR_USER' => $user->USR_UID
@@ -138,7 +116,7 @@ class DelegationFactory extends Factory
// Return with default values // Return with default values
return [ return [
'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), 'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID, 'APP_UID' => $application->APP_UID,
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'APP_NUMBER' => $application->APP_NUMBER, 'APP_NUMBER' => $application->APP_NUMBER,
@@ -149,59 +127,47 @@ class DelegationFactory extends Factory
'DEL_TYPE' => 'NORMAL', 'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1, 'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'DEL_THREAD_STATUS_ID' => 1,
'DEL_PRIORITY' => 3, 'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $this->faker->dateTime(), 'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_INIT_DATE' => $this->faker->dateTime(), 'DEL_INIT_DATE' => $faker->dateTime(),
'DEL_TASK_DUE_DATE' => $this->faker->dateTime(), 'DEL_TASK_DUE_DATE' => $faker->dateTime(),
'DEL_RISK_DATE' => $this->faker->dateTime(), 'DEL_RISK_DATE' => $faker->dateTime(),
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID, 'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '', 'DEL_DATA' => '',
'DEL_TITLE' => $this->faker->word() 'DEL_TITLE' => $faker->word()
]; ];
}; });
return $this->state($state);
}
/** // Create a open delegation
* Create a open delegation $factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $faker) {
* @return type
*/
public function open()
{
$state = function (array $attributes) {
// Create dates with sense // Create dates with sense
$delegateDate = $this->faker->dateTime(); $delegateDate = $faker->dateTime();
$initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes'); $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day'); $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day'); $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
return [ return [
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'DEL_THREAD_STATUS_ID' => 1,
'DEL_DELEGATE_DATE' => $delegateDate, 'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INIT_DATE' => $initDate, 'DEL_INIT_DATE' => $initDate,
'DEL_RISK_DATE' => $riskDate, 'DEL_RISK_DATE' => $riskDate,
'DEL_TASK_DUE_DATE' => $taskDueDate, 'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_FINISH_DATE' => null 'DEL_FINISH_DATE' => null
]; ];
}; });
return $this->state($state);
}
/** // Create a closed delegation
* Create a closed delegation $factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker $faker) {
* @return type
*/
public function closed()
{
$state = function (array $attributes) {
// Create dates with sense // Create dates with sense
$delegateDate = $this->faker->dateTime(); $delegateDate = $faker->dateTime();
$initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes'); $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day'); $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day'); $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
$finishDate = $this->faker->dateTimeInInterval($initDate, '+10 days'); $finishDate = $faker->dateTimeInInterval($initDate, '+10 days');
return [ return [
'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_THREAD_STATUS' => 'CLOSED',
@@ -211,37 +177,21 @@ class DelegationFactory extends Factory
'DEL_TASK_DUE_DATE' => $taskDueDate, 'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_FINISH_DATE' => $finishDate 'DEL_FINISH_DATE' => $finishDate
]; ];
}; });
return $this->state($state);
} // Create a last delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'last_thread', function (Faker $faker) {
/**
* Create a last delegation
* @return type
*/
public function last_thread()
{
$state = function (array $attributes) {
return [ return [
'DEL_LAST_INDEX' => 1, 'DEL_LAST_INDEX' => 1,
]; ];
}; });
return $this->state($state);
} // Create a first delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'first_thread', function (Faker $faker) {
/**
* Create a first delegation
* @return type
*/
public function first_thread()
{
$state = function (array $attributes) {
return [ return [
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0, 'DEL_PREVIOUS' => 0,
]; ];
}; });
return $this->state($state);
}
}

View File

@@ -1,46 +1,34 @@
<?php <?php
namespace Database\Factories;
use App\Factories\Factory;
use G;
use Illuminate\Support\Str;
class WebEntryFactory extends Factory
{
/** /**
* Define the model's default state. * Model factory for web entries
*
* @return array
*/ */
public function definition() use Faker\Generator as Faker;
{
$factory->define(\ProcessMaker\Model\WebEntry::class, function(Faker $faker) {
return [ return [
'WE_UID' => G::generateUniqueID(), 'WE_UID' => G::generateUniqueID(),
'PRO_UID' => G::generateUniqueID(), 'PRO_UID' => G::generateUniqueID(),
'TAS_UID' => G::generateUniqueID(), 'TAS_UID' => G::generateUniqueID(),
'DYN_UID' => G::generateUniqueID(), 'DYN_UID' => G::generateUniqueID(),
'USR_UID' => G::generateUniqueID(), 'USR_UID' => G::generateUniqueID(),
'WE_METHOD' => $this->faker->randomElement(['WS', 'HTML']), 'WE_METHOD' => $faker->randomElement(['WS', 'HTML']),
'WE_INPUT_DOCUMENT_ACCESS' => $this->faker->randomElement([0, 1]), 'WE_INPUT_DOCUMENT_ACCESS' => $faker->randomElement([0, 1]),
'WE_DATA' => G::generateUniqueID() . '.php', 'WE_DATA' => G::generateUniqueID() . '.php',
'WE_CREATE_USR_UID' => G::generateUniqueID(), 'WE_CREATE_USR_UID' => G::generateUniqueID(),
'WE_UPDATE_USR_UID' => G::generateUniqueID(), 'WE_UPDATE_USR_UID' => G::generateUniqueID(),
'WE_CREATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), 'WE_CREATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'),
'WE_UPDATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), 'WE_UPDATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'),
'WE_TYPE' => $this->faker->randomElement(['SINGLE', 'MULTIPLE']), 'WE_TYPE' => $faker->randomElement(['SINGLE', 'MULTIPLE']),
'WE_CUSTOM_TITLE' => $this->faker->words(5, true), 'WE_CUSTOM_TITLE' => $faker->words(5, true),
'WE_AUTHENTICATION' => $this->faker->randomElement(['LOGIN_REQUIRED', 'ANONYMOUS']), 'WE_AUTHENTICATION' => $faker->randomElement(['LOGIN_REQUIRED', 'ANONYMOUS']),
'WE_HIDE_INFORMATION_BAR' => $this->faker->randomElement(['0', '1']), 'WE_HIDE_INFORMATION_BAR' => $faker->randomElement(['0', '1']),
'WE_CALLBACK' => $this->faker->randomElement(['PROCESSMAKER', 'CUSTOM', 'CUSTOM_CLEAR']), 'WE_HIDE_ACTIVE_SESSION_WARNING' => $faker->randomElement(['0', '1']),
'WE_CALLBACK_URL' => $this->faker->url, 'WE_CALLBACK' => $faker->randomElement(['PROCESSMAKER', 'CUSTOM', 'CUSTOM_CLEAR']),
'WE_LINK_GENERATION' => $this->faker->randomElement(['DEFAULT', 'ADVANCED']), 'WE_CALLBACK_URL' => $faker->url,
'WE_LINK_GENERATION' => $faker->randomElement(['DEFAULT', 'ADVANCED']),
'WE_LINK_SKIN' => 'classic', 'WE_LINK_SKIN' => 'classic',
'WE_LINK_LANGUAGE' => 'en', 'WE_LINK_LANGUAGE' => 'en',
'WE_LINK_DOMAIN' => $this->faker->domainName, 'WE_LINK_DOMAIN' => $faker->domainName,
'WE_SHOW_IN_NEW_CASE' => $this->faker->randomElement(['0', '1']) 'WE_SHOW_IN_NEW_CASE' => $faker->randomElement(['0', '1'])
]; ];
} });
}

View File

@@ -17,7 +17,7 @@ class ServerTest extends TestCase
/** /**
* Setup method. * Setup method.
*/ */
public function setUp(): void public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->server = $_SERVER; $this->server = $_SERVER;
@@ -29,7 +29,7 @@ class ServerTest extends TestCase
/** /**
* Teardown method. * Teardown method.
*/ */
public function tearDown(): void public function tearDown()
{ {
parent::tearDown(); parent::tearDown();
$_SERVER = $this->server; $_SERVER = $this->server;
@@ -42,8 +42,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_with_valid_credentials() public function it_should_test_post_token_with_valid_credentials()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::factory()->create([ $oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID "USR_UID" => $user->USR_UID
]); ]);
@@ -80,8 +80,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_with_return_handle_token() public function it_should_test_post_token_with_return_handle_token()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::factory()->create([ $oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID "USR_UID" => $user->USR_UID
]); ]);
@@ -116,8 +116,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_with_empty_client_id() public function it_should_test_post_token_with_empty_client_id()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::factory()->create([ $oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID "USR_UID" => $user->USR_UID
]); ]);
@@ -155,8 +155,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_for_pm_client_id() public function it_should_test_post_token_for_pm_client_id()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::where('CLIENT_ID', '=', 'x-pm-local-client')->get()->first(); $oauthClients = OauthClients::where('CLIENT_ID', '=', 'x-pm-local-client')->first();
$data = '{ $data = '{
"grant_type":"password", "grant_type":"password",
@@ -202,7 +202,7 @@ class ServerTest extends TestCase
file_put_contents($filename, $data); file_put_contents($filename, $data);
LicenseManager::truncate(); LicenseManager::truncate();
LicenseManager::factory()->create([ factory(LicenseManager::class)->create([
"LICENSE_DATA" => $data, "LICENSE_DATA" => $data,
"LICENSE_PATH" => $filename, "LICENSE_PATH" => $filename,
"LICENSE_WORKSPACE" => env('MAIN_SYS_SYS') "LICENSE_WORKSPACE" => env('MAIN_SYS_SYS')

View File

@@ -140,14 +140,15 @@ class Capsule {
} }
} }
@ini_set('track_errors', true);
include $__template; include $__template;
@ini_restore('track_errors');
// restore the include path // restore the include path
ini_set('include_path', $__old_inc_path); ini_set('include_path', $__old_inc_path);
$lastError = error_get_last(); if (!empty($php_errormsg)) {
if (!empty($lastError['message'])) { throw new Exception("Unable to parse template " . $__template . ": " . $php_errormsg);
throw new Exception("Unable to parse template " . $__template . ": " . $lastError['message']);
} }
} }