Solving conflicts for PMC-1126
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
parent
c95280fe2a
commit
8b5ef84fa7
@@ -9,6 +9,7 @@
|
|||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
syntaxCheck="true"
|
syntaxCheck="true"
|
||||||
bootstrap="tests/bootstrap.php"
|
bootstrap="tests/bootstrap.php"
|
||||||
|
stderr="true"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="LegacyClasses">
|
<testsuite name="LegacyClasses">
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ define('PATH_RBAC', PATH_RBAC_HOME . 'engine/classes/');
|
|||||||
define("PATH_CUSTOM_SKINS", PATH_DATA . "skins/");
|
define("PATH_CUSTOM_SKINS", PATH_DATA . "skins/");
|
||||||
define("PATH_TPL", PATH_CORE . "templates/");
|
define("PATH_TPL", PATH_CORE . "templates/");
|
||||||
define('PATH_C', PATH_DATA . 'compiled/');
|
define('PATH_C', PATH_DATA . 'compiled/');
|
||||||
|
define('DB_HOST', env('DB_HOST'));
|
||||||
|
define('DB_NAME', env('DB_DATABASE'));
|
||||||
|
define('DB_USER', env('DB_USERNAME'));
|
||||||
|
define('DB_PASS', env('DB_PASSWORD'));
|
||||||
|
define('PATH_HOME', PATH_TRUNK . '/workflow/');
|
||||||
|
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/');
|
||||||
|
|
||||||
// Set Time Zone
|
// Set Time Zone
|
||||||
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)(env('MAIN_SYSTEM_UTC_TIME_ZONE', 'workflow')) == 1;
|
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)(env('MAIN_SYSTEM_UTC_TIME_ZONE', 'workflow')) == 1;
|
||||||
|
|||||||
102
tests/unit/workflow/engine/controllers/DesignerTest.php
Normal file
102
tests/unit/workflow/engine/controllers/DesignerTest.php
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\unit\workflow\engine\controllers;
|
||||||
|
|
||||||
|
use Designer;
|
||||||
|
use G;
|
||||||
|
use ProcessMaker\Model\Application;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class DesignerTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Tests that the Designer::index() method is not throwing an exception
|
||||||
|
*
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_that_the_index_method_is_not_throwing_an_exception()
|
||||||
|
{
|
||||||
|
//Create the process factory
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
//Create the application factory
|
||||||
|
$application = factory(Application::class)->create(
|
||||||
|
[
|
||||||
|
'APP_PIN' => G::encryptOld('LJ5W'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
//Start the session for the user logged
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
$_SESSION['CASE'] = $application->APP_NUMBER;
|
||||||
|
$_SESSION['PIN'] = "LJ5W";
|
||||||
|
$_SESSION['USER_LOGGED'] = '00000000000000000000000000000001';
|
||||||
|
|
||||||
|
session_commit();
|
||||||
|
|
||||||
|
//Create the data sent to the tracker request
|
||||||
|
$httpData = (object)[
|
||||||
|
"prj_uid" => $process->PRO_UID,
|
||||||
|
"prj_readonly" => "true",
|
||||||
|
"app_uid" => $application->APP_UID,
|
||||||
|
"tracker_designer" => "1"
|
||||||
|
];
|
||||||
|
|
||||||
|
//Create the Designer object
|
||||||
|
$object = new Designer();
|
||||||
|
|
||||||
|
//Turn on output buffering
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
//Call the index method
|
||||||
|
$object->index($httpData);
|
||||||
|
|
||||||
|
//Get current buffer contents and delete current output buffer in $res variable
|
||||||
|
$res = ob_get_clean();
|
||||||
|
|
||||||
|
//Assert the result does not have errors
|
||||||
|
$this->assertNotContains('Call to a member function getUsrUid() on null', $res);
|
||||||
|
$this->assertNotContains('Uncaught TypeError: Argument 2 passed to Illumincate\Routing\UrlGenerator::_construct() must be an instance of Illuminate\Http\Request, null given',
|
||||||
|
$res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the Designer::index() method when the user logged is empty
|
||||||
|
*
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_index_method_when_the_user_logged_is_empty()
|
||||||
|
{
|
||||||
|
//Create the process factory
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
//Create the application factory
|
||||||
|
$application = factory(Application::class)->create(
|
||||||
|
[
|
||||||
|
'APP_PIN' => G::encryptOld('LJ5W'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$_SESSION['CASE'] = $application->APP_NUMBER;
|
||||||
|
$_SESSION['PIN'] = "LJ5W";
|
||||||
|
|
||||||
|
session_commit();
|
||||||
|
|
||||||
|
//Create the data sent to the tracker request
|
||||||
|
$httpData = (object)[
|
||||||
|
"prj_uid" => $process->PRO_UID,
|
||||||
|
"prj_readonly" => "true",
|
||||||
|
"app_uid" => $application->APP_UID,
|
||||||
|
"tracker_designer" => "1"
|
||||||
|
];
|
||||||
|
|
||||||
|
//Create the Designer object
|
||||||
|
$object = new Designer();
|
||||||
|
|
||||||
|
//An exception is expected if the user logged is empty
|
||||||
|
$this->expectExceptionMessage("Local Authentication Error, user session is not started.");
|
||||||
|
|
||||||
|
//Call the index method
|
||||||
|
$object->index($httpData);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,12 +40,12 @@ class Designer extends Controller
|
|||||||
|
|
||||||
$clientToken = $this->getCredentials($httpData);
|
$clientToken = $this->getCredentials($httpData);
|
||||||
$debug = false; //System::isDebugMode();
|
$debug = false; //System::isDebugMode();
|
||||||
|
|
||||||
$consolidated = 0;
|
$consolidated = 0;
|
||||||
$enterprise = 0;
|
$enterprise = 0;
|
||||||
$distribution = 0;
|
$distribution = 0;
|
||||||
|
|
||||||
$usrUid = $RBAC->userObj->getUsrUid();
|
$usrUid = (isset($RBAC->userObj)) ? $RBAC->userObj->getUsrUid() : '';
|
||||||
|
|
||||||
$userProperties = UsersPropertiesPeer::retrieveByPk($usrUid);
|
$userProperties = UsersPropertiesPeer::retrieveByPk($usrUid);
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
@@ -72,7 +72,8 @@ class Designer extends Controller
|
|||||||
$this->setVar("SYS_LANG", SYS_LANG);
|
$this->setVar("SYS_LANG", SYS_LANG);
|
||||||
$this->setVar("SYS_SKIN", SYS_SKIN);
|
$this->setVar("SYS_SKIN", SYS_SKIN);
|
||||||
$this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd());
|
$this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd());
|
||||||
$this->setVar('PMDYNAFORM_FIRST_TIME', $userProperties->getPmdynaformFirstTime());
|
isset($userProperties) ? $this->setVar('PMDYNAFORM_FIRST_TIME',
|
||||||
|
$userProperties->getPmdynaformFirstTime()) : $this->setVar('PMDYNAFORM_FIRST_TIME', '0');
|
||||||
$inpuDocument = new InputDocument();
|
$inpuDocument = new InputDocument();
|
||||||
$this->setVar('maxFileSizeInformation', G::json_encode($inpuDocument->getMaxFileSize()));
|
$this->setVar('maxFileSizeInformation', G::json_encode($inpuDocument->getMaxFileSize()));
|
||||||
|
|
||||||
@@ -99,7 +100,8 @@ class Designer extends Controller
|
|||||||
$this->setVar('pmuiJsCacheFile', file(PATH_HTML . "lib-dev/pmUI/build.cache", FILE_IGNORE_NEW_LINES));
|
$this->setVar('pmuiJsCacheFile', file(PATH_HTML . "lib-dev/pmUI/build.cache", FILE_IGNORE_NEW_LINES));
|
||||||
$this->setVar('pmuiCssCacheFile', file(PATH_HTML . "lib-dev/pmUI/css.cache", FILE_IGNORE_NEW_LINES));
|
$this->setVar('pmuiCssCacheFile', file(PATH_HTML . "lib-dev/pmUI/css.cache", FILE_IGNORE_NEW_LINES));
|
||||||
|
|
||||||
$this->setVar('designerCacheFile', file(PATH_HTML . "lib-dev/mafe/applications.cache", FILE_IGNORE_NEW_LINES));
|
$this->setVar('designerCacheFile',
|
||||||
|
file(PATH_HTML . "lib-dev/mafe/applications.cache", FILE_IGNORE_NEW_LINES));
|
||||||
$this->setVar('mafeJsFiles', $mafeJsFiles);
|
$this->setVar('mafeJsFiles', $mafeJsFiles);
|
||||||
$this->setVar('mafeCssFiles', $mafeCssFiles);
|
$this->setVar('mafeCssFiles', $mafeCssFiles);
|
||||||
} else {
|
} else {
|
||||||
@@ -253,7 +255,6 @@ class Designer extends Controller
|
|||||||
"Content-Type" => "multipart/form-data;",
|
"Content-Type" => "multipart/form-data;",
|
||||||
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
|
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$request = new Request(array(), $request, array(), array(), array(), $server, null, $headers);
|
$request = new Request(array(), $request, array(), array(), array(), $server, null, $headers);
|
||||||
$oauthServer = new Server();
|
$oauthServer = new Server();
|
||||||
$response = $oauthServer->postToken($request, true);
|
$response = $oauthServer->postToken($request, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user