Merged in bugfix/PMCORE-3069 (pull request #7975)
PMCORE-3069 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
@@ -7,7 +7,6 @@ $factory->define(\ProcessMaker\Model\Application::class, function(Faker $faker)
|
|||||||
$appNumber = $faker->unique()->numberBetween(1000);
|
$appNumber = $faker->unique()->numberBetween(1000);
|
||||||
// APP_TITLE field is used in 'MYSQL: MATCH() AGAINST()' function, string size should not be less than 3.
|
// APP_TITLE field is used in 'MYSQL: MATCH() AGAINST()' function, string size should not be less than 3.
|
||||||
$appTitle = $faker->lexify(str_repeat('?', rand(3, 5)) . ' ' . str_repeat('?', rand(3, 5)));
|
$appTitle = $faker->lexify(str_repeat('?', rand(3, 5)) . ' ' . str_repeat('?', rand(3, 5)));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'APP_UID' => G::generateUniqueID(),
|
'APP_UID' => G::generateUniqueID(),
|
||||||
'APP_TITLE' => $appTitle,
|
'APP_TITLE' => $appTitle,
|
||||||
@@ -24,10 +23,10 @@ $factory->define(\ProcessMaker\Model\Application::class, function(Faker $faker)
|
|||||||
'APP_INIT_USER' => $user->USR_UID,
|
'APP_INIT_USER' => $user->USR_UID,
|
||||||
'APP_CUR_USER' => $user->USR_UID,
|
'APP_CUR_USER' => $user->USR_UID,
|
||||||
'APP_PIN' => G::generateUniqueID(),
|
'APP_PIN' => G::generateUniqueID(),
|
||||||
'APP_CREATE_DATE' => $faker->dateTime(),
|
'APP_CREATE_DATE' => $faker->dateTimeBetween('now', '+30 minutes'),
|
||||||
'APP_INIT_DATE' => $faker->dateTime(),
|
'APP_INIT_DATE' => $faker->dateTimeBetween('now', '+30 minutes'),
|
||||||
'APP_UPDATE_DATE' => $faker->dateTime(),
|
'APP_UPDATE_DATE' => $faker->dateTimeBetween('now', '+30 minutes'),
|
||||||
'APP_FINISH_DATE' => $faker->dateTime(),
|
'APP_FINISH_DATE' => $faker->dateTimeBetween('now', '+30 minutes'),
|
||||||
'APP_DATA' => serialize(['APP_NUMBER' => $appNumber])
|
'APP_DATA' => serialize(['APP_NUMBER' => $appNumber])
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class ExecuteQueryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function it_should_insert_a_record_in_the_category_table_using_the_execute_query_method()
|
public function it_should_insert_a_record_in_the_category_table_using_the_execute_query_method()
|
||||||
{
|
{
|
||||||
|
$this->expectException(SQLException::class);
|
||||||
$database = env('DB_DATABASE');
|
$database = env('DB_DATABASE');
|
||||||
$faker = Factory::create();
|
$faker = Factory::create();
|
||||||
$uid = G::generateUniqueID();
|
$uid = G::generateUniqueID();
|
||||||
@@ -132,6 +133,7 @@ class ExecuteQueryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function it_should_replace_a_record_in_the_category_table_using_the_execute_query_method()
|
public function it_should_replace_a_record_in_the_category_table_using_the_execute_query_method()
|
||||||
{
|
{
|
||||||
|
$this->expectException(SQLException::class);
|
||||||
$database = env('DB_DATABASE');
|
$database = env('DB_DATABASE');
|
||||||
$faker = Factory::create();
|
$faker = Factory::create();
|
||||||
$id = $faker->unique()->numberBetween(1, 10000000);
|
$id = $faker->unique()->numberBetween(1, 10000000);
|
||||||
@@ -168,6 +170,7 @@ class ExecuteQueryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function it_should_update_a_record_in_the_category_table_using_the_execute_query_method()
|
public function it_should_update_a_record_in_the_category_table_using_the_execute_query_method()
|
||||||
{
|
{
|
||||||
|
$this->expectException(SQLException::class);
|
||||||
$database = env('DB_DATABASE');
|
$database = env('DB_DATABASE');
|
||||||
$faker = Factory::create();
|
$faker = Factory::create();
|
||||||
$id = $faker->unique()->numberBetween(1, 10000000);
|
$id = $faker->unique()->numberBetween(1, 10000000);
|
||||||
@@ -200,7 +203,7 @@ class ExecuteQueryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function it_should_delete_a_record_in_the_category_table_using_the_execute_query_method()
|
public function it_should_delete_a_record_in_the_category_table_using_the_execute_query_method()
|
||||||
{
|
{
|
||||||
|
$this->expectException(SQLException::class);
|
||||||
$database = env('DB_DATABASE');
|
$database = env('DB_DATABASE');
|
||||||
$category = factory(ProcessCategory::class)->create();
|
$category = factory(ProcessCategory::class)->create();
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use G;
|
use G;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use ProcessMaker\BusinessModel\Cases\AbstractCases;
|
use ProcessMaker\BusinessModel\Cases\AbstractCases;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Process;
|
use ProcessMaker\Model\Process;
|
||||||
use ProcessMaker\Model\ProcessCategory;
|
use ProcessMaker\Model\ProcessCategory;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
@@ -131,6 +133,19 @@ class AbstractCasesTest extends TestCase
|
|||||||
$this->assertNotEmpty($actual);
|
$this->assertNotEmpty($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the exception setPriorities
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setPriorities()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_exception_priorities()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
$absCases->setPriorities(['INVALID_VALUE']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check the getter and setter related to the case number
|
* This check the getter and setter related to the case number
|
||||||
*
|
*
|
||||||
@@ -208,6 +223,19 @@ class AbstractCasesTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the exception setInboxStatus
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setInboxStatus()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_exception_inbox_status()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
$absCases->setInboxStatus('INVALID_VALUE');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check the getter and setter related to the participated status
|
* This check the getter and setter related to the participated status
|
||||||
*
|
*
|
||||||
@@ -225,6 +253,19 @@ class AbstractCasesTest extends TestCase
|
|||||||
$this->assertEquals($arguments[$index], $actual);
|
$this->assertEquals($arguments[$index], $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the exception setParticipatedStatus
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setParticipatedStatus()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_exception_participated_status()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
$absCases->setParticipatedStatus('INVALID_VALUE');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check the getter and setter related to the risk status
|
* This check the getter and setter related to the risk status
|
||||||
*
|
*
|
||||||
@@ -242,6 +283,19 @@ class AbstractCasesTest extends TestCase
|
|||||||
$this->assertEquals($arguments[$index], $actual);
|
$this->assertEquals($arguments[$index], $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the exception setRiskStatus
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setRiskStatus()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_exception_risk_status()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
$absCases->setRiskStatus('INVALID_VALUE');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check the getter and setter related to the case status
|
* This check the getter and setter related to the case status
|
||||||
*
|
*
|
||||||
@@ -258,9 +312,22 @@ class AbstractCasesTest extends TestCase
|
|||||||
$actual = $absCases->getCaseStatus();
|
$actual = $absCases->getCaseStatus();
|
||||||
$this->assertEquals($index, $actual);
|
$this->assertEquals($index, $actual);
|
||||||
// Incorrect canceled status
|
// Incorrect canceled status
|
||||||
$absCases->setCaseStatuses(['CANCELLED']);
|
$absCases->setCaseStatus('CANCELLED');
|
||||||
$actual = $absCases->getCaseStatuses();
|
$actual = $absCases->getCaseStatus();
|
||||||
$this->assertEquals([4], $actual);
|
$this->assertEquals($index, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the exception setCaseStatus
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseStatus()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_exception_case_status()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
$absCases->setCaseStatus('INVALID_VALUE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,6 +351,19 @@ class AbstractCasesTest extends TestCase
|
|||||||
$this->assertNotEmpty($actual);
|
$this->assertNotEmpty($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the exception setCaseStatuses
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCaseStatuses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_exception_case_statuses()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
$absCases->setCaseStatuses(['INVALID_VALUE']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check the getter and setter related to the case
|
* This check the getter and setter related to the case
|
||||||
*
|
*
|
||||||
@@ -532,6 +612,19 @@ class AbstractCasesTest extends TestCase
|
|||||||
$this->assertEquals($arguments[$index], $actual);
|
$this->assertEquals($arguments[$index], $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the exception setOrderDirection
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setOrderDirection()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_exception_order_direction()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
$absCases->setOrderDirection('INVALID_VALUE');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check the getter and setter related to the paged, offset and limit
|
* This check the getter and setter related to the paged, offset and limit
|
||||||
*
|
*
|
||||||
@@ -783,7 +876,29 @@ class AbstractCasesTest extends TestCase
|
|||||||
{"tas_id":'.$task[0]->TAS_ID.', "user_id":1, "due_date":"2020-12-04 19:11:14"},
|
{"tas_id":'.$task[0]->TAS_ID.', "user_id":1, "due_date":"2020-12-04 19:11:14"},
|
||||||
{"tas_id":'.$task[1]->TAS_ID.', "user_id":2, "due_date":"2020-12-04 19:12:45"}
|
{"tas_id":'.$task[1]->TAS_ID.', "user_id":2, "due_date":"2020-12-04 19:12:45"}
|
||||||
]';
|
]';
|
||||||
|
// Default values
|
||||||
$result = $absCases->prepareTaskPending($pending);
|
$result = $absCases->prepareTaskPending($pending);
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
|
// Thread users
|
||||||
|
$result = $absCases->prepareTaskPending($pending, false);
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This get thread information
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::threadInformation()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_thread_information()
|
||||||
|
{
|
||||||
|
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
|
||||||
|
$taskPending = Delegation::getLastThread($delegation->APP_NUMBER);
|
||||||
|
$absCases = new AbstractCases();
|
||||||
|
foreach ($taskPending as $thread) {
|
||||||
|
$thread['APP_STATUS'] = 'TO_DO';
|
||||||
|
$result = $absCases->threadInformation($thread, true, true);
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,6 +39,23 @@ class BatchRoutingTest extends TestCase
|
|||||||
return $delegation;
|
return $delegation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the extended function, currently are not implemented
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\BatchRouting::getColumnsView()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\BatchRouting::getData()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_test_extended_methods()
|
||||||
|
{
|
||||||
|
// Create new BatchRouting object
|
||||||
|
$consolidated = new BatchRouting();
|
||||||
|
$result = $consolidated->getColumnsView();
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
$result = $consolidated->getData();
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This checks the counters is working properly in batch routing
|
* This checks the counters is working properly in batch routing
|
||||||
*
|
*
|
||||||
@@ -49,7 +66,7 @@ class BatchRoutingTest extends TestCase
|
|||||||
{
|
{
|
||||||
// Create factories related to the consolidated cases
|
// Create factories related to the consolidated cases
|
||||||
$cases = $this->createConsolidated();
|
$cases = $this->createConsolidated();
|
||||||
// Create new Draft object
|
// Create new batch routing object
|
||||||
$consolidated = new BatchRouting();
|
$consolidated = new BatchRouting();
|
||||||
$consolidated->setUserId($cases['USR_ID']);
|
$consolidated->setUserId($cases['USR_ID']);
|
||||||
$consolidated->setUserUid($cases['USR_UID']);
|
$consolidated->setUserUid($cases['USR_UID']);
|
||||||
|
|||||||
@@ -42,6 +42,23 @@ class CanceledTest extends TestCase
|
|||||||
return $delegation;
|
return $delegation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the extended function, currently are not implemented
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Canceled::getColumnsView()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Canceled::getData()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_test_extended_methods()
|
||||||
|
{
|
||||||
|
// Create new batch Canceled object
|
||||||
|
$consolidated = new Canceled();
|
||||||
|
$result = $consolidated->getColumnsView();
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
$result = $consolidated->getData();
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This checks the counters is working properly in canceled
|
* This checks the counters is working properly in canceled
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -42,6 +42,23 @@ class CompletedTest extends TestCase
|
|||||||
return $delegation;
|
return $delegation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the extended function, currently are not implemented
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Completed::getColumnsView()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Completed::getData()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_test_extended_methods()
|
||||||
|
{
|
||||||
|
// Create new batch Completed object
|
||||||
|
$consolidated = new Completed();
|
||||||
|
$result = $consolidated->getColumnsView();
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
$result = $consolidated->getData();
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This checks the counters is working properly in completed
|
* This checks the counters is working properly in completed
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
|||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use ProcessMaker\BusinessModel\Cases\Participated;
|
use ProcessMaker\BusinessModel\Cases\Participated;
|
||||||
use ProcessMaker\Model\Application;
|
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Process;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,7 +57,7 @@ class ParticipatedTest extends TestCase
|
|||||||
* @param int
|
* @param int
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function createMultipleParticipated($cases)
|
public function createMultipleParticipated($cases = 2)
|
||||||
{
|
{
|
||||||
$user = factory(\ProcessMaker\Model\User::class)->create();
|
$user = factory(\ProcessMaker\Model\User::class)->create();
|
||||||
|
|
||||||
@@ -85,11 +83,13 @@ class ParticipatedTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData method without filters
|
* It tests the getData without filters
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\Model\Delegation::scopeParticipated()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserId()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setOrderByColumn()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_get_result_without_filters()
|
public function it_get_result_without_filters()
|
||||||
@@ -104,19 +104,22 @@ class ParticipatedTest extends TestCase
|
|||||||
$participated->setUserId($cases['USR_ID']);
|
$participated->setUserId($cases['USR_ID']);
|
||||||
// Set OrderBYColumn value
|
// Set OrderBYColumn value
|
||||||
$participated->setOrderByColumn('APP_NUMBER');
|
$participated->setOrderByColumn('APP_NUMBER');
|
||||||
// Call to getData method
|
// Get the data
|
||||||
$res = $participated->getData();
|
$res = $participated->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals(2, count($res));
|
$this->assertEquals(2, count($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData method with specific filter StartedByMe
|
* It tests the getData the specific filter StartedByMe
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseStatus()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseStatus()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserId()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setParticipatedStatus()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_started_by_me()
|
public function it_filter_by_started_by_me()
|
||||||
@@ -130,23 +133,24 @@ class ParticipatedTest extends TestCase
|
|||||||
// Set the user ID
|
// Set the user ID
|
||||||
$participated->setUserId($cases->USR_ID);
|
$participated->setUserId($cases->USR_ID);
|
||||||
// Get only the TO_DO
|
// Get only the TO_DO
|
||||||
$participated->setCaseStatus(2);
|
$participated->setCaseStatus('TO_DO');
|
||||||
// Set the filter STARTED
|
// Set the filter STARTED
|
||||||
$participated->setParticipatedStatus('STARTED');
|
$participated->setParticipatedStatus('STARTED');
|
||||||
// Set OrderBYColumn value
|
// Get the data
|
||||||
$participated->setOrderByColumn('APP_NUMBER');
|
|
||||||
// Call to getData method
|
|
||||||
$res = $participated->getData();
|
$res = $participated->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals(1, count($res));
|
$this->assertEquals(1, count($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData method with specific filter CompletedByMe
|
* It tests the getData the specific filter CompletedByMe
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setUserId()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setParticipatedStatus()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_completed_by_me()
|
public function it_filter_by_completed_by_me()
|
||||||
@@ -161,20 +165,21 @@ class ParticipatedTest extends TestCase
|
|||||||
$participated->setUserId($cases->USR_ID);
|
$participated->setUserId($cases->USR_ID);
|
||||||
// Set the filter COMPLETED
|
// Set the filter COMPLETED
|
||||||
$participated->setParticipatedStatus('COMPLETED');
|
$participated->setParticipatedStatus('COMPLETED');
|
||||||
// Set OrderBYColumn value
|
// Get the data
|
||||||
$participated->setOrderByColumn('APP_NUMBER');
|
|
||||||
// Call to getData method
|
|
||||||
$res = $participated->getData();
|
$res = $participated->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals(0, count($res));
|
$this->assertEquals(0, count($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData method with processId filter
|
* It tests the getData the specific filter setProcessId
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @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()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setProcessId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -190,11 +195,9 @@ class ParticipatedTest extends TestCase
|
|||||||
$participated->setUserUid($cases['USR_UID']);
|
$participated->setUserUid($cases['USR_UID']);
|
||||||
// Set the user ID
|
// Set the user ID
|
||||||
$participated->setUserId($cases['USR_ID']);
|
$participated->setUserId($cases['USR_ID']);
|
||||||
// Set the process ID
|
// Set the process
|
||||||
$participated->setProcessId($cases['PRO_ID']);
|
$participated->setProcessId($cases['PRO_ID']);
|
||||||
// Set OrderBYColumn value
|
// Get the data
|
||||||
$participated->setOrderByColumn('APP_NUMBER');
|
|
||||||
// Call to getData method
|
|
||||||
$res = $participated->getData();
|
$res = $participated->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals(2, count($res));
|
$this->assertEquals(2, count($res));
|
||||||
@@ -223,9 +226,7 @@ class ParticipatedTest extends TestCase
|
|||||||
$participated->setUserId($cases['USR_ID']);
|
$participated->setUserId($cases['USR_ID']);
|
||||||
// Set the case numbers
|
// Set the case numbers
|
||||||
$participated->setCasesNumbers([$cases['APP_NUMBER']]);
|
$participated->setCasesNumbers([$cases['APP_NUMBER']]);
|
||||||
// Set OrderBYColumn value
|
// Get the data
|
||||||
$participated->setOrderByColumn('APP_NUMBER');
|
|
||||||
// Call to getData method
|
|
||||||
$res = $participated->getData();
|
$res = $participated->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals(2, count($res));
|
$this->assertEquals(2, count($res));
|
||||||
@@ -255,20 +256,21 @@ class ParticipatedTest extends TestCase
|
|||||||
// Set the range of case numbers
|
// Set the range of case numbers
|
||||||
$rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER'];
|
$rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER'];
|
||||||
$participated->setRangeCasesFromTo([$rangeOfCases]);
|
$participated->setRangeCasesFromTo([$rangeOfCases]);
|
||||||
// Set OrderBYColumn value
|
// Get the data
|
||||||
$participated->setOrderByColumn('APP_NUMBER');
|
|
||||||
// Call to getData method
|
|
||||||
$res = $participated->getData();
|
$res = $participated->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals(2, count($res));
|
$this->assertEquals(2, count($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData method with processId filter
|
* It tests the getData the specific filter setCaseTitle
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @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::setCaseTitle()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseTitle()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -295,9 +297,165 @@ class ParticipatedTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getCounter method
|
* It tests the getData the specific filter status
|
||||||
|
*
|
||||||
|
* @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::setCaseStatus()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_status()
|
||||||
|
{
|
||||||
|
// 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 status
|
||||||
|
$participated->setCaseStatus('TO_DO');
|
||||||
|
// Get the data
|
||||||
|
$result = $participated->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getData the specific filter setStartCaseFrom and getStartCaseTo
|
||||||
|
*
|
||||||
|
* @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::setStartCaseFrom()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setStartCaseTo()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_start_date()
|
||||||
|
{
|
||||||
|
// 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 range of dates
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$participated->setStartCaseFrom($date);
|
||||||
|
$participated->setStartCaseTo($date);
|
||||||
|
// Get the data
|
||||||
|
$result = $participated->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getData the specific filter setFinishCaseFrom and setFinishCaseTo
|
||||||
|
*
|
||||||
|
* @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::setFinishCaseFrom()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setFinishCaseTo()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_finish_date()
|
||||||
|
{
|
||||||
|
// 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 range of dates
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$participated->setFinishCaseFrom($date);
|
||||||
|
$participated->setFinishCaseTo($date);
|
||||||
|
// Get the data
|
||||||
|
$result = $participated->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertEmpty($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_progress()
|
||||||
|
{
|
||||||
|
// Create factories related to the participated cases
|
||||||
|
$cases = $this->createParticipated();
|
||||||
|
// 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('IN_PROGRESS');
|
||||||
|
// Get result
|
||||||
|
$result = $participated->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* It tests the specific filter setParticipatedStatus = COMPLETED
|
||||||
|
*
|
||||||
|
* @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_completed()
|
||||||
|
{
|
||||||
|
// Create factories related to the participated cases
|
||||||
|
$cases = $this->createParticipated();
|
||||||
|
// 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('COMPLETED');
|
||||||
|
// Get result
|
||||||
|
$result = $participated->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCounter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getCounter()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getCounter()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setParticipatedStatus()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_get_counter()
|
public function it_get_counter()
|
||||||
@@ -319,7 +477,7 @@ class ParticipatedTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getPagingCounters() method
|
* It tests the getPagingCounters
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getPagingCounters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getPagingCounters()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
@@ -332,17 +490,14 @@ class ParticipatedTest extends TestCase
|
|||||||
$participated->setUserId($cases->USR_ID);
|
$participated->setUserId($cases->USR_ID);
|
||||||
$participated->setUserUid($cases->USR_UID);
|
$participated->setUserUid($cases->USR_UID);
|
||||||
$participated->setParticipatedStatus('STARTED');
|
$participated->setParticipatedStatus('STARTED');
|
||||||
|
|
||||||
$res = $participated->getPagingCounters();
|
$res = $participated->getPagingCounters();
|
||||||
$this->assertEquals(3, $res);
|
$this->assertEquals(3, $res);
|
||||||
|
|
||||||
$delegation = Delegation::select()->where('USR_ID', $cases->USR_ID)->first();
|
$delegation = Delegation::select()->where('USR_ID', $cases->USR_ID)->first();
|
||||||
|
|
||||||
$participated->setCaseNumber($delegation->APP_NUMBER);
|
$participated->setCaseNumber($delegation->APP_NUMBER);
|
||||||
$participated->setProcessId($delegation->PRO_ID);
|
$participated->setProcessId($delegation->PRO_ID);
|
||||||
$participated->setTaskId($delegation->TAS_ID);
|
$participated->setTaskId($delegation->TAS_ID);
|
||||||
$participated->setCaseUid($delegation->APP_UID);
|
$participated->setCaseUid($delegation->APP_UID);
|
||||||
|
|
||||||
$res = $participated->getPagingCounters();
|
$res = $participated->getPagingCounters();
|
||||||
$this->assertEquals(1, $res);
|
$this->assertEquals(1, $res);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class SearchTest extends TestCase
|
|||||||
$search = new Search();
|
$search = new Search();
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals(count($cases), count($result));
|
$this->assertNotEmpty($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,6 +66,8 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setCaseNumber()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setOrderByColumn()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_app_number()
|
public function it_filter_by_app_number()
|
||||||
@@ -88,6 +90,7 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setCasesNumbers()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_specific_cases()
|
public function it_filter_by_specific_cases()
|
||||||
@@ -97,8 +100,6 @@ class SearchTest extends TestCase
|
|||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
$search->setCasesNumbers([$cases[0]->APP_NUMBER]);
|
$search->setCasesNumbers([$cases[0]->APP_NUMBER]);
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
|
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
|
||||||
@@ -110,6 +111,7 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setRangeCasesFromTo()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_range_cases()
|
public function it_filter_by_range_cases()
|
||||||
@@ -120,8 +122,6 @@ class SearchTest extends TestCase
|
|||||||
$search = new Search();
|
$search = new Search();
|
||||||
$rangeOfCases = $cases[0]->APP_NUMBER . "-" . $cases[0]->APP_NUMBER;
|
$rangeOfCases = $cases[0]->APP_NUMBER . "-" . $cases[0]->APP_NUMBER;
|
||||||
$search->setRangeCasesFromTo([$rangeOfCases]);
|
$search->setRangeCasesFromTo([$rangeOfCases]);
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
@@ -133,6 +133,7 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setProcessId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_process()
|
public function it_filter_by_process()
|
||||||
@@ -142,8 +143,6 @@ class SearchTest extends TestCase
|
|||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
$search->setProcessId($cases[0]->PRO_ID);
|
$search->setProcessId($cases[0]->PRO_ID);
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
@@ -155,6 +154,7 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setTaskId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_task()
|
public function it_filter_by_task()
|
||||||
@@ -164,8 +164,6 @@ class SearchTest extends TestCase
|
|||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
$search->setTaskId($cases[0]->TAS_ID);
|
$search->setTaskId($cases[0]->TAS_ID);
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
@@ -177,6 +175,7 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setCaseTitle()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_thread_title()
|
public function it_filter_by_thread_title()
|
||||||
@@ -202,6 +201,7 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setUserId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_user()
|
public function it_filter_by_user()
|
||||||
@@ -211,19 +211,42 @@ class SearchTest extends TestCase
|
|||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
$search->setUserId($cases[0]->USR_ID);
|
$search->setUserId($cases[0]->USR_ID);
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData with priority
|
* It tests the getData with user
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setStartCaseFrom()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setStartCaseTo()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_start_date()
|
||||||
|
{
|
||||||
|
// Create factories related to the delegation cases
|
||||||
|
$cases = $this->createSearch();
|
||||||
|
// Create new Search object
|
||||||
|
$search = new Search();
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$search->setStartCaseFrom($date);
|
||||||
|
$search->setStartCaseTo($date);
|
||||||
|
$result = $search->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getData with status
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::setCaseStatuses()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_status()
|
public function it_filter_by_status()
|
||||||
@@ -233,8 +256,6 @@ class SearchTest extends TestCase
|
|||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
$search->setCaseStatuses(['TO_DO']);
|
$search->setCaseStatuses(['TO_DO']);
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// This assert that the expected numbers of results are returned
|
// This assert that the expected numbers of results are returned
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
@@ -253,12 +274,9 @@ class SearchTest extends TestCase
|
|||||||
$casesNotSubmitted = factory(Delegation::class, 5)->states('web_entry')->create();
|
$casesNotSubmitted = factory(Delegation::class, 5)->states('web_entry')->create();
|
||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$result = $search->getData();
|
$result = $search->getData();
|
||||||
// Review if the cases not submitted are not considered
|
// Review if the cases not submitted are not considered
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
$this->assertEquals(count($result) , count($cases));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -273,8 +291,6 @@ class SearchTest extends TestCase
|
|||||||
$cases = $this->createSearch();
|
$cases = $this->createSearch();
|
||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$total = $search->getCounter();
|
$total = $search->getCounter();
|
||||||
// The count for search was disabled for performance issues
|
// The count for search was disabled for performance issues
|
||||||
$this->assertEquals($total, 0);
|
$this->assertEquals($total, 0);
|
||||||
@@ -293,8 +309,6 @@ class SearchTest extends TestCase
|
|||||||
$cases = $this->createSearch();
|
$cases = $this->createSearch();
|
||||||
// Create new Search object
|
// Create new Search object
|
||||||
$search = new Search();
|
$search = new Search();
|
||||||
// Set order by column value
|
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
|
||||||
$total = $search->getPagingCounters();
|
$total = $search->getPagingCounters();
|
||||||
// The count for search was disabled for performance issues
|
// The count for search was disabled for performance issues
|
||||||
$this->assertEquals($total, 0);
|
$this->assertEquals($total, 0);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use ProcessMaker\BusinessModel\Cases\Supervising;
|
use ProcessMaker\BusinessModel\Cases\Supervising;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\GroupUser;
|
|
||||||
use ProcessMaker\Model\Process;
|
use ProcessMaker\Model\Process;
|
||||||
use ProcessMaker\Model\ProcessUser;
|
use ProcessMaker\Model\ProcessUser;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
@@ -323,48 +322,54 @@ class SupervisingTest extends TestCase
|
|||||||
* Tests the getData() method when the user is a supervisor of the process(es)
|
* Tests the getData() method when the user is a supervisor of the process(es)
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_the_get_data_method_when_the_user_is_supervisor()
|
public function it_should_test_the_get_data_method_when_the_user_is_supervisor()
|
||||||
{
|
{
|
||||||
$cases = $this->createSupervising();
|
$cases = $this->createSupervising();
|
||||||
// Instance the Supervising class
|
// Instance the Supervising class
|
||||||
$Supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
// Set the user UID
|
// Set the user UID
|
||||||
$Supervising->setUserUid($cases->USR_UID);
|
$supervising->setUserUid($cases->USR_UID);
|
||||||
// Set the user ID
|
// Set the user
|
||||||
$Supervising->setUserId($cases->USR_ID);
|
$supervising->setUserId($cases->USR_ID);
|
||||||
// Call the getData method
|
// Get the data
|
||||||
$res = $Supervising->getData();
|
$result = $supervising->getData();
|
||||||
// Asserts the result contains 3 registers
|
// Asserts the result contains 3 registers
|
||||||
$this->assertCount(3, $res);
|
$this->assertCount(3, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the getData() method when the user belongs to a group supervisor
|
* Tests the getData() method when the user belongs to a group supervisor
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_the_get_data_method_when_the_user_belong_to_a_group_supervisor()
|
public function it_should_test_the_get_data_method_when_the_user_belong_to_a_group_supervisor()
|
||||||
{
|
{
|
||||||
$cases = $this->createSupervising();
|
$cases = $this->createSupervising();
|
||||||
// Instance the Supervising object
|
// Instance the Supervising object
|
||||||
$Supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
// Set the user UID
|
// Set the user UID
|
||||||
$Supervising->setUserUid($cases->USR_UID);
|
$supervising->setUserUid($cases->USR_UID);
|
||||||
// Set the user ID
|
// Set the user ID
|
||||||
$Supervising->setUserId($cases->USR_ID);
|
$supervising->setUserId($cases->USR_ID);
|
||||||
// Call the getData method
|
// Get the data
|
||||||
$res = $Supervising->getData();
|
$result = $supervising->getData();
|
||||||
// Asserts the result contains 3 registers
|
// Asserts the result contains 3 registers
|
||||||
$this->assertCount(3, $res);
|
$this->assertCount(3, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the getData() method when the user is not a supervisor neither belongs to a group supervisor
|
* Tests the getData() method when the user is not a supervisor neither belongs to a group supervisor
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_the_get_data_method_when_the_user_is_not_supervisor()
|
public function it_should_test_the_get_data_method_when_the_user_is_not_supervisor()
|
||||||
@@ -372,44 +377,25 @@ class SupervisingTest extends TestCase
|
|||||||
$user = factory(User::class)->create();
|
$user = factory(User::class)->create();
|
||||||
$cases = $this->createSupervising();
|
$cases = $this->createSupervising();
|
||||||
// Instance the Supervising object
|
// Instance the Supervising object
|
||||||
$Supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
// Set the user UID
|
// Set the user UID
|
||||||
$Supervising->setUserUid($user->USR_UID);
|
$supervising->setUserUid($user->USR_UID);
|
||||||
// Set the user ID
|
// Set the user
|
||||||
$Supervising->setUserId($user->USR_ID);
|
$supervising->setUserId($user->USR_ID);
|
||||||
// Call the getData method
|
// Get the data
|
||||||
$res = $Supervising->getData();
|
$result = $supervising->getData();
|
||||||
// Asserts the result
|
// Asserts the result
|
||||||
$this->assertEmpty($res);
|
$this->assertEmpty($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the getCounter() method
|
* Tests the specific filter setCaseNumber
|
||||||
*
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getCounter()
|
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function it_should_count_the_data()
|
|
||||||
{
|
|
||||||
$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);
|
|
||||||
// Call the getCounter method
|
|
||||||
$res = $Supervising->getCounter();
|
|
||||||
// Assert the counter
|
|
||||||
$this->assertEquals(3, $res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests the filter by APP_NUMBER
|
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseNumber()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseNumber()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -417,55 +403,59 @@ class SupervisingTest extends TestCase
|
|||||||
{
|
{
|
||||||
$cases = $this->createSupervising();
|
$cases = $this->createSupervising();
|
||||||
// Instance the Supervising object
|
// Instance the Supervising object
|
||||||
$Supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
// Set the user UID
|
// Set the user UID
|
||||||
$Supervising->setUserUid($cases->USR_UID);
|
$supervising->setUserUid($cases->USR_UID);
|
||||||
// Set the user ID
|
// Set the user
|
||||||
$Supervising->setUserId($cases->USR_ID);
|
$supervising->setUserId($cases->USR_ID);
|
||||||
// Set the case number
|
// Set the case number
|
||||||
$Supervising->setCaseNumber($cases->APP_NUMBER);
|
$supervising->setCaseNumber($cases->APP_NUMBER);
|
||||||
// Call the getData method
|
// Get the data
|
||||||
$res = $Supervising->getData();
|
$result = $supervising->getData();
|
||||||
// Asserts the result contains 3 registers
|
// Asserts the result contains 3 registers
|
||||||
$this->assertCount(1, $res);
|
$this->assertCount(1, $result);
|
||||||
// Asserts that the result contains the app number searched
|
// Asserts that the result contains the app number searched
|
||||||
$this->assertContains($cases->APP_NUMBER, $res[0]);
|
$this->assertContains($cases->APP_NUMBER, $result[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the filter by APP_NUMBER
|
* Tests the specific filter setCasesNumbers
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseNumber()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCasesNumbers()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_filter_by_specific_cases()
|
public function it_filter_by_specific_cases()
|
||||||
{
|
{
|
||||||
$cases = $this->createSupervising();
|
$cases = $this->createSupervising();
|
||||||
// Instance the Supervising object
|
// Instance the Supervising object
|
||||||
$Supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
// Set the user UID
|
// Set the user UID
|
||||||
$Supervising->setUserUid($cases->USR_UID);
|
$supervising->setUserUid($cases->USR_UID);
|
||||||
// Set the user ID
|
// Set the user
|
||||||
$Supervising->setUserId($cases->USR_ID);
|
$supervising->setUserId($cases->USR_ID);
|
||||||
// Set the case numbers
|
// Set the case numbers
|
||||||
$Supervising->setCasesNumbers([$cases->APP_NUMBER]);
|
$supervising->setCasesNumbers([$cases->APP_NUMBER]);
|
||||||
// Call the getData method
|
// Get the data
|
||||||
$res = $Supervising->getData();
|
$result = $supervising->getData();
|
||||||
// Asserts the result contains 3 registers
|
// Asserts the result contains 3 registers
|
||||||
$this->assertCount(1, $res);
|
$this->assertCount(1, $result);
|
||||||
// Asserts that the result contains the app number searched
|
// Asserts that the result contains the app number searched
|
||||||
$this->assertContains($cases->APP_NUMBER, $res[0]);
|
$this->assertContains($cases->APP_NUMBER, $result[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the filter by APP_NUMBER
|
* Tests the specific filter setRangeCasesFromTo
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setRangeCasesFromTo()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setRangeCasesFromTo()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -473,78 +463,30 @@ class SupervisingTest extends TestCase
|
|||||||
{
|
{
|
||||||
$cases = $this->createSupervising();
|
$cases = $this->createSupervising();
|
||||||
// Instance the Supervising object
|
// Instance the Supervising object
|
||||||
$Supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
// Set the user UID
|
// Set the user UID
|
||||||
$Supervising->setUserUid($cases->USR_UID);
|
$supervising->setUserUid($cases->USR_UID);
|
||||||
// Set the user ID
|
// Set the user ID
|
||||||
$Supervising->setUserId($cases->USR_ID);
|
$supervising->setUserId($cases->USR_ID);
|
||||||
// Set the range of case numbers
|
// Set the range of case numbers
|
||||||
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
|
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
|
||||||
$Supervising->setRangeCasesFromTo([$rangeOfCases]);
|
$supervising->setRangeCasesFromTo([$rangeOfCases]);
|
||||||
// Call the getData method
|
// Get the data
|
||||||
$res = $Supervising->getData();
|
$result = $supervising->getData();
|
||||||
// Asserts the result contains 3 registers
|
// Asserts the result contains 3 registers
|
||||||
$this->assertCount(1, $res);
|
$this->assertCount(1, $result);
|
||||||
// Asserts that the result contains the app number searched
|
// Asserts that the result contains the app number searched
|
||||||
$this->assertContains($cases->APP_NUMBER, $res[0]);
|
$this->assertContains($cases->APP_NUMBER, $result[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the filter by process
|
* Tests the specific filter caseTitle
|
||||||
*
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setProcessId()
|
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function it_filter_by_process()
|
|
||||||
{
|
|
||||||
$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 Id filter
|
|
||||||
$Supervising->setProcessId($cases['PRO_ID']);
|
|
||||||
// Call the getData method
|
|
||||||
$res = $Supervising->getData();
|
|
||||||
$this->assertCount(3, $res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests the filter by process
|
|
||||||
*
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setTaskId()
|
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function it_filter_by_task()
|
|
||||||
{
|
|
||||||
$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 Id filter
|
|
||||||
$Supervising->setTaskId($cases['TAS_ID']);
|
|
||||||
// Call the getData method
|
|
||||||
$res = $Supervising->getData();
|
|
||||||
$this->assertCount(3, $res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* It tests the getData method with case title filter
|
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseTitle()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseTitle()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -566,9 +508,152 @@ class SupervisingTest extends TestCase
|
|||||||
// Set the title
|
// Set the title
|
||||||
$supervising->setCaseTitle($title);
|
$supervising->setCaseTitle($title);
|
||||||
// Get the data
|
// Get the data
|
||||||
$res = $supervising->getData();
|
$result = $supervising->getData();
|
||||||
// Asserts
|
// Asserts
|
||||||
$this->assertCount(1, $res);
|
$this->assertCount(1, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the specific filter process
|
||||||
|
*
|
||||||
|
* @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::setProcessId()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_process()
|
||||||
|
{
|
||||||
|
$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->setProcessId($cases['PRO_ID']);
|
||||||
|
// Get the data
|
||||||
|
$result = $supervising->getData();
|
||||||
|
$this->assertCount(3, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the specific filter task
|
||||||
|
*
|
||||||
|
* @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::setTaskId()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_task()
|
||||||
|
{
|
||||||
|
$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 task
|
||||||
|
$supervising->setTaskId($cases['TAS_ID']);
|
||||||
|
// Get the data
|
||||||
|
$result = $supervising->getData();
|
||||||
|
$this->assertCount(3, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the specific filter status
|
||||||
|
*
|
||||||
|
* @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::setCaseStatus()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_status()
|
||||||
|
{
|
||||||
|
$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 task
|
||||||
|
$supervising->setCaseStatus('TO_DO');
|
||||||
|
// Get the data
|
||||||
|
$result = $supervising->getData();
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getData the specific filter setStartCaseFrom and getStartCaseTo
|
||||||
|
*
|
||||||
|
* @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::setStartCaseFrom()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setStartCaseTo()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_start_date()
|
||||||
|
{
|
||||||
|
$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 range of dates
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$supervising->setStartCaseFrom($date);
|
||||||
|
$supervising->setStartCaseTo($date);
|
||||||
|
// Get the data
|
||||||
|
$result = $supervising->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getData the specific filter setFinishCaseFrom and setFinishCaseTo
|
||||||
|
*
|
||||||
|
* @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::setFinishCaseFrom()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setFinishCaseTo()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_finish_date()
|
||||||
|
{
|
||||||
|
$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 range of dates
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$supervising->setFinishCaseFrom($date);
|
||||||
|
$supervising->setFinishCaseTo($date);
|
||||||
|
// Get the data
|
||||||
|
$result = $supervising->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertEmpty($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -578,6 +663,8 @@ class SupervisingTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setOrderByColumn()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setOrderByColumn()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_order_by_column()
|
public function it_order_by_column()
|
||||||
@@ -594,18 +681,41 @@ class SupervisingTest extends TestCase
|
|||||||
];
|
];
|
||||||
$index = array_rand($columnsView);
|
$index = array_rand($columnsView);
|
||||||
// Instance the Supervising object
|
// Instance the Supervising object
|
||||||
$Supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
//Set the user UID
|
// Set the user UID
|
||||||
$Supervising->setUserUid($cases['USR_UID']);
|
$supervising->setUserUid($cases['USR_UID']);
|
||||||
//Set the user ID
|
// Set the user ID
|
||||||
$Supervising->setUserId($cases['USR_ID']);
|
$supervising->setUserId($cases['USR_ID']);
|
||||||
//Set the order by value
|
// Set the order by value
|
||||||
$Supervising->setOrderByColumn($columnsView[$index]);
|
$supervising->setOrderByColumn($columnsView[$index]);
|
||||||
//Call the getData method
|
// Get the data
|
||||||
$result = $Supervising->getData();
|
$result = $supervising->getData();
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the getCounter() method
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getCounter()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_count_the_data()
|
||||||
|
{
|
||||||
|
$cases = $this->createSupervising();
|
||||||
|
// Instance the Supervising object
|
||||||
|
$supervising = new Supervising();
|
||||||
|
// Set the user UID
|
||||||
|
$supervising->setUserUid($cases->USR_UID);
|
||||||
|
// Set the user
|
||||||
|
$supervising->setUserId($cases->USR_ID);
|
||||||
|
// Get the data
|
||||||
|
$result = $supervising->getCounter();
|
||||||
|
// Assert the counter
|
||||||
|
$this->assertEquals(3, $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getPagingCounters() method
|
* It tests the getPagingCounters() method
|
||||||
*
|
*
|
||||||
@@ -618,8 +728,8 @@ class SupervisingTest extends TestCase
|
|||||||
$supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
$supervising->setUserId($cases->USR_ID);
|
$supervising->setUserId($cases->USR_ID);
|
||||||
$supervising->setUserUid($cases->USR_UID);
|
$supervising->setUserUid($cases->USR_UID);
|
||||||
|
// Get the count
|
||||||
$res = $supervising->getPagingCounters();
|
$result = $supervising->getPagingCounters();
|
||||||
$this->assertEquals(3, $res);
|
$this->assertEquals(3, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,8 +364,8 @@ class TaskTest extends TestCase
|
|||||||
public function it_should_test_fillReportByUser_method($asynchronous)
|
public function it_should_test_fillReportByUser_method($asynchronous)
|
||||||
{
|
{
|
||||||
$task = new Task($asynchronous, '');
|
$task = new Task($asynchronous, '');
|
||||||
$dateInit = $this->faker->dateTime;
|
$dateInit = $this->faker->dateTime->format("Y-m-d H:i:s");
|
||||||
$dateFinish = $this->faker->dateTime;
|
$dateFinish = $this->faker->dateTime->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
//assert synchronous for cron file
|
//assert synchronous for cron file
|
||||||
if ($asynchronous === false) {
|
if ($asynchronous === false) {
|
||||||
@@ -394,8 +394,8 @@ class TaskTest extends TestCase
|
|||||||
public function it_should_test_fillReportByProcess_method($asynchronous)
|
public function it_should_test_fillReportByProcess_method($asynchronous)
|
||||||
{
|
{
|
||||||
$task = new Task($asynchronous, '');
|
$task = new Task($asynchronous, '');
|
||||||
$dateInit = $this->faker->dateTime;
|
$dateInit = $this->faker->dateTime->format("Y-m-d H:i:s");
|
||||||
$dateFinish = $this->faker->dateTime;
|
$dateFinish = $this->faker->dateTime->format("Y-m-d H:i:s");
|
||||||
|
|
||||||
//assert synchronous for cron file
|
//assert synchronous for cron file
|
||||||
if ($asynchronous === false) {
|
if ($asynchronous === false) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Cases;
|
|||||||
use G;
|
use G;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
class Draft extends AbstractCases
|
class Draft extends AbstractCases
|
||||||
{
|
{
|
||||||
@@ -14,10 +15,11 @@ class Draft extends AbstractCases
|
|||||||
'APP_DELEGATION.APP_NUMBER', // Case #
|
'APP_DELEGATION.APP_NUMBER', // Case #
|
||||||
'APP_DELEGATION.DEL_TITLE', // Case Title
|
'APP_DELEGATION.DEL_TITLE', // Case Title
|
||||||
'PROCESS.PRO_TITLE', // Process
|
'PROCESS.PRO_TITLE', // Process
|
||||||
'TASK.TAS_TITLE', // Task
|
'TASK.TAS_TITLE', // Task
|
||||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
||||||
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
||||||
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
||||||
|
'APP_DELEGATION.DEL_PREVIOUS', // Previous
|
||||||
// Additional column for other functionalities
|
// Additional column for other functionalities
|
||||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||||
@@ -119,6 +121,13 @@ class Draft extends AbstractCases
|
|||||||
// Apply the date format defined in environment
|
// Apply the date format defined in environment
|
||||||
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
||||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||||
|
// Get the send by related to the previous index
|
||||||
|
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||||
|
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||||
|
$result = [];
|
||||||
|
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||||
|
$result['user_tooltip'] = $userInfo;
|
||||||
|
$item['SEND_BY_INFO'] = $result;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Cases;
|
|||||||
use G;
|
use G;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
class Inbox extends AbstractCases
|
class Inbox extends AbstractCases
|
||||||
{
|
{
|
||||||
@@ -14,13 +15,14 @@ class Inbox extends AbstractCases
|
|||||||
'APP_DELEGATION.APP_NUMBER', // Case #
|
'APP_DELEGATION.APP_NUMBER', // Case #
|
||||||
'APP_DELEGATION.DEL_TITLE', // Case Title
|
'APP_DELEGATION.DEL_TITLE', // Case Title
|
||||||
'PROCESS.PRO_TITLE', // Process
|
'PROCESS.PRO_TITLE', // Process
|
||||||
'TASK.TAS_TITLE', // Task
|
'TASK.TAS_TITLE', // Task
|
||||||
'USERS.USR_USERNAME', // Current UserName
|
'USERS.USR_USERNAME', // Current UserName
|
||||||
'USERS.USR_FIRSTNAME', // Current User FirstName
|
'USERS.USR_FIRSTNAME', // Current User FirstName
|
||||||
'USERS.USR_LASTNAME', // Current User LastName
|
'USERS.USR_LASTNAME', // Current User LastName
|
||||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
||||||
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
||||||
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
||||||
|
'APP_DELEGATION.DEL_PREVIOUS', // Previous
|
||||||
// Additional column for other functionalities
|
// Additional column for other functionalities
|
||||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||||
@@ -134,6 +136,13 @@ class Inbox extends AbstractCases
|
|||||||
// Apply the date format defined in environment
|
// Apply the date format defined in environment
|
||||||
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
||||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||||
|
// Get the send by related to the previous index
|
||||||
|
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||||
|
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||||
|
$result = [];
|
||||||
|
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||||
|
$result['user_tooltip'] = $userInfo;
|
||||||
|
$item['SEND_BY_INFO'] = $result;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,13 +16,14 @@ class Participated extends AbstractCases
|
|||||||
'APP_DELEGATION.APP_NUMBER', // Case #
|
'APP_DELEGATION.APP_NUMBER', // Case #
|
||||||
'APP_DELEGATION.DEL_TITLE', // Case Title
|
'APP_DELEGATION.DEL_TITLE', // Case Title
|
||||||
'PROCESS.PRO_TITLE', // Process Name
|
'PROCESS.PRO_TITLE', // Process Name
|
||||||
'TASK.TAS_TITLE', // Pending Task
|
'TASK.TAS_TITLE', // Pending Task
|
||||||
'TASK.TAS_ASSIGN_TYPE', // Task assign rule
|
'TASK.TAS_ASSIGN_TYPE', // Task assign rule
|
||||||
'APPLICATION.APP_STATUS', // Status
|
'APPLICATION.APP_STATUS', // Status
|
||||||
'APPLICATION.APP_CREATE_DATE', // Start Date
|
'APPLICATION.APP_CREATE_DATE', // Start Date
|
||||||
'APPLICATION.APP_FINISH_DATE', // Finish Date
|
'APPLICATION.APP_FINISH_DATE', // Finish Date
|
||||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
|
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
|
||||||
'USERS.USR_ID', // Current UserId
|
'APP_DELEGATION.DEL_PREVIOUS', // Previous
|
||||||
|
'USERS.USR_ID', // Current UserId
|
||||||
// Additional column for other functionalities
|
// Additional column for other functionalities
|
||||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||||
@@ -213,6 +214,13 @@ class Participated extends AbstractCases
|
|||||||
$item['PENDING'] = $result;
|
$item['PENDING'] = $result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Get the send by related to the previous index
|
||||||
|
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||||
|
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||||
|
$result = [];
|
||||||
|
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||||
|
$result['user_tooltip'] = $userInfo;
|
||||||
|
$item['SEND_BY_INFO'] = $result;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel\Cases;
|
|||||||
|
|
||||||
use G;
|
use G;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
class Paused extends AbstractCases
|
class Paused extends AbstractCases
|
||||||
{
|
{
|
||||||
@@ -13,13 +14,14 @@ class Paused extends AbstractCases
|
|||||||
'APP_DELEGATION.APP_NUMBER', // Case #
|
'APP_DELEGATION.APP_NUMBER', // Case #
|
||||||
'APP_DELEGATION.DEL_TITLE', // Case Title
|
'APP_DELEGATION.DEL_TITLE', // Case Title
|
||||||
'PROCESS.PRO_TITLE', // Process
|
'PROCESS.PRO_TITLE', // Process
|
||||||
'TASK.TAS_TITLE', // Task
|
'TASK.TAS_TITLE', // Task
|
||||||
'USERS.USR_USERNAME', // Current UserName
|
'USERS.USR_USERNAME', // Current UserName
|
||||||
'USERS.USR_FIRSTNAME', // Current User FirstName
|
'USERS.USR_FIRSTNAME', // Current User FirstName
|
||||||
'USERS.USR_LASTNAME', // Current User LastName
|
'USERS.USR_LASTNAME', // Current User LastName
|
||||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
||||||
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
||||||
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
||||||
|
'APP_DELEGATION.DEL_PREVIOUS', // Previous
|
||||||
// Additional column for other functionalities
|
// Additional column for other functionalities
|
||||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||||
@@ -128,6 +130,13 @@ class Paused extends AbstractCases
|
|||||||
// Apply the date format defined in environment
|
// Apply the date format defined in environment
|
||||||
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
||||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||||
|
// Get the send by related to the previous index
|
||||||
|
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||||
|
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||||
|
$result = [];
|
||||||
|
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||||
|
$result['user_tooltip'] = $userInfo;
|
||||||
|
$item['SEND_BY_INFO'] = $result;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Cases;
|
|||||||
use ProcessMaker\Model\AppNotes;
|
use ProcessMaker\Model\AppNotes;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\ProcessUser;
|
use ProcessMaker\Model\ProcessUser;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
class Supervising extends AbstractCases
|
class Supervising extends AbstractCases
|
||||||
{
|
{
|
||||||
@@ -14,11 +15,12 @@ class Supervising extends AbstractCases
|
|||||||
'APP_DELEGATION.APP_NUMBER', // Case #
|
'APP_DELEGATION.APP_NUMBER', // Case #
|
||||||
'APP_DELEGATION.DEL_TITLE', // Case Title
|
'APP_DELEGATION.DEL_TITLE', // Case Title
|
||||||
'PROCESS.PRO_TITLE', // Process Name
|
'PROCESS.PRO_TITLE', // Process Name
|
||||||
'TASK.TAS_TITLE', // Pending Task
|
'TASK.TAS_TITLE', // Pending Task
|
||||||
'APPLICATION.APP_STATUS', // Status
|
'APPLICATION.APP_STATUS', // Status
|
||||||
'APPLICATION.APP_CREATE_DATE', // Start Date
|
'APPLICATION.APP_CREATE_DATE', // Start Date
|
||||||
'APPLICATION.APP_FINISH_DATE', // Finish Date
|
'APPLICATION.APP_FINISH_DATE', // Finish Date
|
||||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
|
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
|
||||||
|
'APP_DELEGATION.DEL_PREVIOUS', // Previous
|
||||||
'USERS.USR_ID', // Current UserId
|
'USERS.USR_ID', // Current UserId
|
||||||
// Additional column for other functionalities
|
// Additional column for other functionalities
|
||||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||||
@@ -159,6 +161,13 @@ class Supervising extends AbstractCases
|
|||||||
$information[] = $this->threadInformation($thread);
|
$information[] = $this->threadInformation($thread);
|
||||||
}
|
}
|
||||||
$item['PENDING'] = $information;
|
$item['PENDING'] = $information;
|
||||||
|
// Get the send by related to the previous index
|
||||||
|
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||||
|
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||||
|
$result = [];
|
||||||
|
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||||
|
$result['user_tooltip'] = $userInfo;
|
||||||
|
$item['SEND_BY_INFO'] = $result;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Cases;
|
|||||||
use G;
|
use G;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
class Unassigned extends AbstractCases
|
class Unassigned extends AbstractCases
|
||||||
{
|
{
|
||||||
@@ -14,13 +15,14 @@ class Unassigned extends AbstractCases
|
|||||||
'APP_DELEGATION.APP_NUMBER', // Case #
|
'APP_DELEGATION.APP_NUMBER', // Case #
|
||||||
'APP_DELEGATION.DEL_TITLE', // Case Title
|
'APP_DELEGATION.DEL_TITLE', // Case Title
|
||||||
'PROCESS.PRO_TITLE', // Process
|
'PROCESS.PRO_TITLE', // Process
|
||||||
'TASK.TAS_TITLE', // Task
|
'TASK.TAS_TITLE', // Task
|
||||||
'USERS.USR_USERNAME', // Current UserName
|
'USERS.USR_USERNAME', // Current UserName
|
||||||
'USERS.USR_FIRSTNAME', // Current User FirstName
|
'USERS.USR_FIRSTNAME', // Current User FirstName
|
||||||
'USERS.USR_LASTNAME', // Current User LastName
|
'USERS.USR_LASTNAME', // Current User LastName
|
||||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
||||||
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
||||||
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
||||||
|
'APP_DELEGATION.DEL_PREVIOUS', // Previous
|
||||||
// Additional column for other functionalities
|
// Additional column for other functionalities
|
||||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||||
@@ -136,6 +138,13 @@ class Unassigned extends AbstractCases
|
|||||||
// Apply the date format defined in environment
|
// Apply the date format defined in environment
|
||||||
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
||||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||||
|
// Get the send by related to the previous index
|
||||||
|
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||||
|
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||||
|
$result = [];
|
||||||
|
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||||
|
$result['user_tooltip'] = $userInfo;
|
||||||
|
$item['SEND_BY_INFO'] = $result;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Application extends Model
|
|||||||
* @param int $user
|
* @param int $user
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
*/
|
*/
|
||||||
public function scopeUserId($query, $user)
|
public function scopeUserId($query, int $user)
|
||||||
{
|
{
|
||||||
return $query->where('APP_DELEGATION.USR_ID', '=', $user);
|
return $query->where('APP_DELEGATION.USR_ID', '=', $user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ class Delegation extends Model
|
|||||||
* @param int $user
|
* @param int $user
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
*/
|
*/
|
||||||
public function scopeUserId($query, $user)
|
public function scopeUserId($query, int $user)
|
||||||
{
|
{
|
||||||
return $query->where('APP_DELEGATION.USR_ID', '=', $user);
|
return $query->where('APP_DELEGATION.USR_ID', '=', $user);
|
||||||
}
|
}
|
||||||
@@ -1751,7 +1751,7 @@ class Delegation extends Model
|
|||||||
*/
|
*/
|
||||||
public static function getThreadInfo(int $appNumber, int $index)
|
public static function getThreadInfo(int $appNumber, int $index)
|
||||||
{
|
{
|
||||||
$query = Delegation::query()->select(['APP_NUMBER', 'TAS_UID', 'TAS_ID', 'DEL_PREVIOUS', 'DEL_TITLE']);
|
$query = Delegation::query()->select(['APP_NUMBER', 'TAS_UID', 'TAS_ID', 'DEL_PREVIOUS', 'DEL_TITLE', 'USR_ID']);
|
||||||
$query->where('APP_NUMBER', $appNumber);
|
$query->where('APP_NUMBER', $appNumber);
|
||||||
$query->where('DEL_INDEX', $index);
|
$query->where('DEL_INDEX', $index);
|
||||||
$query->limit(1);
|
$query->limit(1);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class User extends Model
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
*/
|
*/
|
||||||
public function scopeUserId($query, string $usrId)
|
public function scopeUserId($query, int $usrId)
|
||||||
{
|
{
|
||||||
return $query->where('USR_ID', '=', $usrId);
|
return $query->where('USR_ID', '=', $usrId);
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ class User extends Model
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getInformation($usrId)
|
public static function getInformation(int $usrId)
|
||||||
{
|
{
|
||||||
$query = User::query()->select([
|
$query = User::query()->select([
|
||||||
'USR_USERNAME',
|
'USR_USERNAME',
|
||||||
|
|||||||
Reference in New Issue
Block a user