Merged in release/3.7.4 (pull request #8376)

release/3.7.4
This commit is contained in:
Paula Quispe
2022-02-03 15:50:34 +00:00
41 changed files with 713 additions and 314 deletions

View File

@@ -18,6 +18,8 @@ use ProcessMaker\Model\User;
use Tests\TestCase;
/**
* Class AbstractCasesTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\AbstractCases
*/
class AbstractCasesTest extends TestCase

View File

@@ -9,6 +9,8 @@ use ProcessMaker\Model\Delegation;
use Tests\TestCase;
/**
* Class BatchRoutingTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\BatchRouting
*/
class BatchRoutingTest extends TestCase
@@ -44,6 +46,7 @@ class BatchRoutingTest extends TestCase
*
* @covers \ProcessMaker\BusinessModel\Cases\BatchRouting::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\BatchRouting::getData()
* @covers \ProcessMaker\BusinessModel\Cases\BatchRouting::filters()
* @test
*/
public function it_test_extended_methods()
@@ -51,7 +54,7 @@ class BatchRoutingTest extends TestCase
// Create new BatchRouting object
$consolidated = new BatchRouting();
$result = $consolidated->getColumnsView();
$this->assertEmpty($result);
$this->assertNotEmpty($result);
$result = $consolidated->getData();
$this->assertEmpty($result);
}

View File

@@ -9,6 +9,8 @@ use ProcessMaker\Model\Delegation;
use Tests\TestCase;
/**
* Class CanceledTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Canceled
*/
class CanceledTest extends TestCase
@@ -52,10 +54,10 @@ class CanceledTest extends TestCase
public function it_test_extended_methods()
{
// Create new batch Canceled object
$consolidated = new Canceled();
$result = $consolidated->getColumnsView();
$this->assertEmpty($result);
$result = $consolidated->getData();
$canceled = new Canceled();
$result = $canceled->getColumnsView();
$this->assertNotEmpty($result);
$result = $canceled->getData();
$this->assertEmpty($result);
}

View File

@@ -9,6 +9,8 @@ use ProcessMaker\Model\Delegation;
use Tests\TestCase;
/**
* Class CasesListTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\CasesList
*/
class CasesListTest extends TestCase

View File

@@ -9,6 +9,8 @@ use ProcessMaker\Model\Delegation;
use Tests\TestCase;
/**
* Class CompletedTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Completed
*/
class CompletedTest extends TestCase
@@ -52,10 +54,10 @@ class CompletedTest extends TestCase
public function it_test_extended_methods()
{
// Create new batch Completed object
$consolidated = new Completed();
$result = $consolidated->getColumnsView();
$this->assertEmpty($result);
$result = $consolidated->getData();
$completed = new Completed();
$result = $completed->getColumnsView();
$this->assertNotEmpty($result);
$result = $completed->getData();
$this->assertEmpty($result);
}

View File

@@ -16,6 +16,8 @@ use ProcessMaker\Model\User;
use Tests\TestCase;
/**
* Class DraftTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Draft
*/
class DraftTest extends TestCase
@@ -121,6 +123,26 @@ class DraftTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with categoryId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_filter_by_category()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$draft = new Draft();
$draft->setUserId($cases['USR_ID']);
$draft->setCategoryId(2000);
$res = $draft->getData();
$this->assertEmpty($res);
}
/**
* It tests the getData method with processId filter
*

View File

@@ -19,6 +19,8 @@ use ProcessMaker\Model\TaskUser;
use Tests\TestCase;
/**
* Class HomeTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Home
*/
class HomeTest extends TestCase

View File

@@ -121,6 +121,29 @@ class InboxTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with categoryId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCategoryId()
* @test
*/
public function it_filter_by_category()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
// Apply filters
$inbox->setUserId($cases->USR_ID);
$inbox->setCategoryId(2000);
// Call to getData method
$res = $inbox->getData();
$this->assertEmpty($res);
}
/**
* It tests the getData method with processId filter
*

View File

@@ -10,7 +10,7 @@ use ProcessMaker\Model\Delegation;
use Tests\TestCase;
/**
* Class InboxTest
* Class ParticipatedTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Participated
*/
@@ -61,6 +61,27 @@ class ParticipatedTest extends TestCase
*
* @return array
*/
public function createParticipatedDraft()
{
$application = factory(Application::class)->states('draft')->create();
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
'APP_NUMBER' => $application->APP_NUMBER,
'APP_UID' => $application->APP_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_INDEX' => 1,
'DEL_LAST_INDEX' => 1,
]);
return $delegation;
}
/**
* Create participated cases factories when the case is CANCELED
*
* @param string
*
* @return array
*/
public function createParticipatedCompleted()
{
$application = factory(Application::class)->states('completed')->create();
@@ -207,6 +228,38 @@ class ParticipatedTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* It tests the getData the specific filter setCategoryId
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setFilterCases()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserUid()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserId()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCategoryId()
* @test
*/
public function it_filter_by_category()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases['USR_UID']);
// Set the user ID
$participated->setUserId($cases['USR_ID']);
// Set the category
$participated->setCategoryId(3000);
// Get the data
$result = $participated->getData();
// Asserts with the result
$this->assertEmpty($result);
}
/**
* It tests the getData the specific filter setProcessId
*
@@ -239,6 +292,67 @@ class ParticipatedTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* It tests the getData the specific filter setTaskId
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setFilterCases()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserUid()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserId()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setProcessId()
* @test
*/
public function it_filter_by_task()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases['USR_UID']);
// Set the user ID
$participated->setUserId($cases['USR_ID']);
// Set the task
$participated->setTaskId($cases['TAS_ID']);
// Get the data
$result = $participated->getData();
// Asserts with the result
$this->assertNotEmpty($result);
}
/**
* It tests the getData the specific filter setCaseNumber
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseNumber()
* @test
*/
public function it_filter_by_specific_case()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases['USR_UID']);
// Set the user ID
$participated->setUserId($cases['USR_ID']);
// Set the case numbers
$participated->setCaseNumber($cases['APP_NUMBER']);
// Get the data
$result = $participated->getData();
// Asserts with the result
$this->assertNotEmpty($result);
}
/**
* It tests the getData method with case number filter
*
@@ -443,7 +557,7 @@ class ParticipatedTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setParticipatedStatus()
* @test
*/
public function it_get_status_in_progress()
public function it_get_status_in_progress_todo()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
@@ -461,6 +575,60 @@ class ParticipatedTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* It tests the specific filter setParticipatedStatus = IN_PROGRESS
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setParticipatedStatus()
* @test
*/
public function it_get_status_in_started_and_completed()
{
// Create factories related to the participated cases
$cases = $this->createParticipatedCompleted();
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set participated status
$participated->setParticipatedStatus('STARTED');
// Get the data
$result = $participated->getData();
// Asserts with the result
$this->assertNotEmpty($result);
}
/**
* It tests the specific filter setParticipatedStatus = IN_PROGRESS
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setParticipatedStatus()
* @test
*/
public function it_get_status_started_and_draft()
{
// Create factories related to the participated cases
$cases = $this->createParticipatedDraft();
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set participated status
$participated->setParticipatedStatus('STARTED');
// Get the data
$result = $participated->getData();
// Asserts with the result
$this->assertNotEmpty($result);
}
/**
* It tests the specific filter setParticipatedStatus = STARTED
*

View File

@@ -300,6 +300,31 @@ class PausedTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with categoryId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_filter_by_category()
{
// Create factories related to the paused cases
$cases = $this->createPaused();
// Create new Paused object
$paused = new Paused();
// Set the user UID
$paused->setUserUid($cases->USR_UID);
// Set the user ID
$paused->setUserId($cases->USR_ID);
$paused->setCategoryId(2000);
// Get the data
$res = $paused->getData();
// Asserts
$this->assertEmpty($res);
}
/**
* It tests the getData method with processId filter
*

View File

@@ -10,7 +10,7 @@ use ProcessMaker\Model\Delegation;
use Tests\TestCase;
/**
* Class InboxTest
* Class SearchTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Search
*/

View File

@@ -15,6 +15,8 @@ use ProcessMaker\Model\User;
use Tests\TestCase;
/**
* Class SupervisingTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Supervising
*/
class SupervisingTest extends TestCase
@@ -405,6 +407,34 @@ class SupervisingTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* Tests the specific filter category
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCategoryId()
* @test
*/
public function it_filter_by_category()
{
$cases = $this->createSupervising();
// Instance the Supervising object
$supervising = new Supervising();
// Set the user UID
$supervising->setUserUid($cases['USR_UID']);
// Set the user ID
$supervising->setUserId($cases['USR_ID']);
// Set the process
$supervising->setCategoryId(2000);
// Get the data
$result = $supervising->getData();
// Asserts with the result
$this->assertEmpty($result);
}
/**
* Tests the specific filter process
*

View File

@@ -22,6 +22,8 @@ use ProcessMaker\Model\User;
use Tests\TestCase;
/**
* Class UnassignedTest
*
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Unassigned
*/
class UnassignedTest extends TestCase
@@ -79,6 +81,13 @@ class UnassignedTest extends TestCase
'TU_RELATION' => $relation, //Related to the user
'TU_TYPE' => 1
]);
//Create the previous delegation before self-service
$delegation = factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'PRO_ID' => $process->PRO_ID,
'DEL_THREAD_STATUS' => 'CLOSED',
'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year"))
]);
//Create the register in delegation relate to self-service
$delegation = factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
@@ -86,6 +95,7 @@ class UnassignedTest extends TestCase
'PRO_ID' => $process->PRO_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
'DEL_PREVIOUS' => $delegation->DEL_INDEX,
'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year"))
]);
}
@@ -143,6 +153,13 @@ class UnassignedTest extends TestCase
'ASSIGNEE_ID' => ($userAssignee) ? $user->USR_ID : $group->GRP_ID,
'ASSIGNEE_TYPE' => $relation
]);
//Create the previous delegation before self-service
$delegation = factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'PRO_ID' => $process->PRO_ID,
'DEL_THREAD_STATUS' => 'CLOSED',
'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year"))
]);
//Create the register in delegation relate to self-service
$delegation = factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
@@ -151,6 +168,7 @@ class UnassignedTest extends TestCase
'PRO_ID' => $process->PRO_ID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_ID' => 0,
'DEL_PREVIOUS' => $delegation->DEL_INDEX,
'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year"))
]);
}
@@ -378,7 +396,30 @@ class UnassignedTest extends TestCase
}
/**
* This ensures get data from self-service-user-assigned with filter setRangeCasesFromTo
* This ensures get data from self-service-user-assigned with filter setCategoryId
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
* @test
*/
public function it_filter_by_category()
{
// Create factories related to the unassigned cases
$cases = $this->createSelfServiceUserOrGroup();
// Create new object
$unassigned = new Unassigned();
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$unassigned->setCategoryId(2000);
// Call to getData method
$res = $unassigned->getData();
// This assert that the expected numbers of results are returned
$this->assertEmpty($res);
}
/**
* This ensures get data from self-service-user-assigned with filter setRangeCasesFromTo, setCasesNumbers, setCaseUid
*
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
@@ -390,11 +431,29 @@ class UnassignedTest extends TestCase
$cases = $this->createSelfServiceUserOrGroup();
// Create new object
$unassigned = new Unassigned();
// Apply filters
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$unassigned->setCasesNumbers([$cases['delegation']->APP_NUMBER]);
$unassigned->setRangeCasesFromTo([]);
// Create new object
$unassigned = new Unassigned();
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$rangeOfCases = $cases['delegation']->APP_NUMBER . "-" . $cases['delegation']->APP_NUMBER;
$unassigned->setCasesNumbers([]);
$unassigned->setRangeCasesFromTo([$rangeOfCases]);
// Create new object
$unassigned = new Unassigned();
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$rangeOfCases = $cases['delegation']->APP_NUMBER . "-" . $cases['delegation']->APP_NUMBER;
$unassigned->setRangeCasesFromTo([$rangeOfCases]);
$unassigned->setCasesNumbers([$cases['delegation']->APP_NUMBER]);
// Create new object
$unassigned = new Unassigned();
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$unassigned->setCaseUid($cases['delegation']->APP_UID);
// Call to getData method
$res = $unassigned->getData();
// This assert that the expected numbers of results are returned

View File

@@ -547,7 +547,7 @@ class TaskTest extends TestCase
//Gets the result
$printing = ob_get_clean();
//Asserts the result is printing that there is no exisiting records to continue a case in the determined date
$this->assertRegExp('/No existing records to continue a case, on date "' . $date . '/', $printing);
$this->assertRegExp('/There are no records to start new cases, on date "' . $date . '/', $printing);
}
//assert asynchronous for job process
if ($asynchronous === true) {