PMC-131 In section Admin->Users->Groups the second page of the list always shows double the corresponding amount of groups
This commit is contained in:
@@ -75,6 +75,7 @@ define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/"
|
||||
define("PATH_DYNAFORM", PATH_DATA_SITE . "xmlForms/");
|
||||
define("PATH_DATA_MAILTEMPLATES", PATH_DATA_SITE . "mailTemplates/");
|
||||
define("PATH_DATA_PUBLIC", PATH_DATA_SITE . "public/");
|
||||
define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP);
|
||||
G::defineConstants();
|
||||
|
||||
/**
|
||||
|
||||
74
tests/unit/workflow/engine/methods/groups/GroupsAjaxTest.php
Normal file
74
tests/unit/workflow/engine/methods/groups/GroupsAjaxTest.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\methods\groups;
|
||||
|
||||
use Faker\Factory;
|
||||
use ProcessMaker\Model\Groupwf;
|
||||
use ProcessMaker\Model\User;
|
||||
use RBAC;
|
||||
use Tests\TestCase;
|
||||
|
||||
class GroupsAjaxTest extends TestCase
|
||||
{
|
||||
private $groups;
|
||||
|
||||
/**
|
||||
* Set up function
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->settingUserLogged();
|
||||
Groupwf::truncate();
|
||||
$this->createGroups();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create records in the GROUPSWF table
|
||||
*/
|
||||
private function createGroups()
|
||||
{
|
||||
$this->groups = factory(Groupwf::class, 10)->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the answer of the option groupsList.
|
||||
* @test
|
||||
*/
|
||||
public function it_should_return_option_groups_list()
|
||||
{
|
||||
global $RBAC;
|
||||
$_POST['action'] = 'groupsList';
|
||||
|
||||
$fileName = PATH_METHODS . 'groups/groups_Ajax.php';
|
||||
|
||||
ob_start();
|
||||
require_once $fileName;
|
||||
$content = ob_get_clean();
|
||||
$content = json_decode($content, JSON_OBJECT_AS_ARRAY);
|
||||
|
||||
$this->assertArrayHasKey("success", $content);
|
||||
$this->assertArrayHasKey("groups", $content);
|
||||
$this->assertTrue($content["success"]);
|
||||
$this->assertTrue(is_array($content["groups"]));
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Admin extends Controller
|
||||
|
||||
$this->setJSVar( 'CONFIG', $Config );
|
||||
$this->setJSVar( 'FORMATS', $c->getFormats() );
|
||||
$this->setJSVar( 'uxTypes', AdminProxy::getUxTypesList( 'list' ) );
|
||||
$this->setJSVar( 'uxTypes', adminProxy::getUxTypesList( 'list' ) );
|
||||
|
||||
G::RenderPage( 'publish', 'extJs' );
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ class adminProxy extends HttpProxyController
|
||||
return array('success' => $success, 'users' => $usersAdmin);
|
||||
}
|
||||
|
||||
public function getUxTypesList($type = 'assoc')
|
||||
public static function getUxTypesList($type = 'assoc')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
|
||||
@@ -59,9 +59,7 @@ switch ($_POST['action']) {
|
||||
$sortDir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "";
|
||||
|
||||
global $RBAC;
|
||||
if ($limit == $start) {
|
||||
$limit = $limit + $limit;
|
||||
}
|
||||
|
||||
$tasks = new TaskUser();
|
||||
$aTask = $tasks->getCountAllTaksByGroups();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user