PMCORE-3680

This commit is contained in:
Paula Quispe
2022-03-14 11:17:52 -04:00
parent 0849fdb4d9
commit 5af6b957e4
2 changed files with 0 additions and 320 deletions

View File

@@ -1,107 +0,0 @@
<?php
namespace Tests\unit\workflow\engine\methods\cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\User;
use RBAC;
use Tests\TestCase;
class ProxyNewCasesListTest extends TestCase
{
use DatabaseTransactions;
/**
* This sets the initial parameters for each test.
*/
public function setUp()
{
parent::setUp(); // TODO: Change the autogenerated stub
$this->settingUserLogged();
}
/**
* This starts a valid user in session with the appropriate permissions.
* @global object $RBAC
*/
private function settingUserLogged()
{
global $RBAC;
$user = User::where('USR_ID', '=', 1)
->get()
->first();
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->initRBAC();
$RBAC->loadUserRolePermission('PROCESSMAKER', $_SESSION['USER_LOGGED']);
}
/**
* It tests the result contains an error
*
* @test
*/
public function it_should_test_there_is_an_error_in_the_proxy_new_cases_list_file()
{
//Turn on output buffering
ob_start();
//Call the tested file
require_once PATH_METHODS . 'cases/proxyNewCasesList.php';
//Return the contents of the output buffer
$outputBuffer = ob_get_contents();
//Clean the output buffer and turn off output buffering
ob_end_clean();
// This asserts there is an error in the output
$this->assertEquals('{"error":"ID_ACCESS_DENIED"}', $outputBuffer);
}
/**
* It tests the result contains an empty "search" field
*
* @test
*/
public function it_should_test_the_response_of_the_proxy_new_cases_list_file()
{
$_REQUEST["paged"] = '';
$_REQUEST['count'] = '';
$_REQUEST["category"] = '';
$_REQUEST["process"] = '';
$_REQUEST["search"] = 'fsfaefwa';
$_REQUEST["filter"] = '';
$_REQUEST["dateFrom"] = '';
$_REQUEST["dateTo"] = '';
$_REQUEST["start"] = '';
$_REQUEST["limit"] = '';
$_REQUEST['sort'] = 'ASC';
$_REQUEST["dir"] = '';
$_REQUEST["action"] = 'todo';
$_REQUEST["user"] = '';
$_REQUEST["list"] = 'inbox';
$_REQUEST["filterStatus"] = '';
$_REQUEST['openApplicationUid'] = '';
//Turn on output buffering
ob_start();
//Call the tested file
require_once PATH_METHODS . 'cases/proxyNewCasesList.php';
//Return the contents of the output buffer
$outputBuffer = ob_get_contents();
//Clean the output buffer and turn off output buffering
ob_end_clean();
$result = json_decode($outputBuffer, true);
//This asserts that the search parameter has an empty value
$this->assertEmpty($result['filters']['search']);
}
}