PMCORE-2583
This commit is contained in:
@@ -124,11 +124,11 @@ class AbstractCasesTest extends TestCase
|
|||||||
public function it_return_set_get_priorities()
|
public function it_return_set_get_priorities()
|
||||||
{
|
{
|
||||||
$absCases = new AbstractCases();
|
$absCases = new AbstractCases();
|
||||||
$arguments = ['', 'VL', 'L', 'N', 'H', 'VH'];
|
$arguments = ['VL', 'L', 'N', 'H', 'VH'];
|
||||||
$index = array_rand($arguments);
|
$index = array_rand($arguments);
|
||||||
$absCases->setPriorities([$arguments[$index]]);
|
$absCases->setPriorities([$arguments[$index]]);
|
||||||
$actual = $absCases->getPriorities();
|
$actual = $absCases->getPriorities();
|
||||||
$this->assertEquals([$index], $actual);
|
$this->assertNotEmpty($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -273,15 +273,15 @@ class AbstractCasesTest extends TestCase
|
|||||||
public function it_return_set_get_case_statuses()
|
public function it_return_set_get_case_statuses()
|
||||||
{
|
{
|
||||||
$absCases = new AbstractCases();
|
$absCases = new AbstractCases();
|
||||||
$arguments = ['', 'DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
|
$arguments = ['DRAFT', 'TO_DO', 'COMPLETED', 'CANCELED'];
|
||||||
$index = array_rand($arguments);
|
$index = array_rand($arguments);
|
||||||
$absCases->setCaseStatuses([$arguments[$index]]);
|
$absCases->setCaseStatuses([$arguments[$index]]);
|
||||||
$actual = $absCases->getCaseStatuses();
|
$actual = $absCases->getCaseStatuses();
|
||||||
$this->assertEquals([$index], $actual);
|
$this->assertNotEmpty($actual);
|
||||||
// Incorrect canceled status
|
// Incorrect canceled status
|
||||||
$absCases->setCaseStatuses(['CANCELLED']);
|
$absCases->setCaseStatuses(['CANCELLED']);
|
||||||
$actual = $absCases->getCaseStatuses();
|
$actual = $absCases->getCaseStatuses();
|
||||||
$this->assertEquals([4], $actual);
|
$this->assertNotEmpty($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class DraftTest extends TestCase
|
|||||||
* It tests the getData method without filters
|
* It tests the getData method without filters
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_get_result_without_filters()
|
public function it_get_result_without_filters()
|
||||||
@@ -112,7 +112,7 @@ class DraftTest extends TestCase
|
|||||||
* It tests the getData method with processId filter
|
* It tests the getData method with processId filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -133,7 +133,7 @@ class DraftTest extends TestCase
|
|||||||
* It tests the getData method with case number filter
|
* It tests the getData method with case number filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -154,7 +154,7 @@ class DraftTest extends TestCase
|
|||||||
* It tests the getData method with taskId filter
|
* It tests the getData method with taskId filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -174,7 +174,7 @@ class DraftTest extends TestCase
|
|||||||
* It tests the getData method with case title filter
|
* It tests the getData method with case title filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -182,14 +182,15 @@ class DraftTest extends TestCase
|
|||||||
{
|
{
|
||||||
// Create factories related to the to_do cases
|
// Create factories related to the to_do cases
|
||||||
$cases = $this->createDraft();
|
$cases = $this->createDraft();
|
||||||
|
$usrId = $cases['USR_ID'];
|
||||||
$title = $cases['DEL_TITLE'];
|
$title = $cases['DEL_TITLE'];
|
||||||
// We need to commit the records inserted because is needed for the "fulltext" index
|
// We need to commit the records inserted because is needed for the "fulltext" index
|
||||||
DB::commit();
|
DB::commit();
|
||||||
// Create new Draft object
|
// Create new Draft object
|
||||||
$draft = new Draft();
|
$draft = new Draft();
|
||||||
$draft->setUserId($cases['USR_ID']);
|
$draft->setUserId($usrId);
|
||||||
// Set the title
|
// Set the title
|
||||||
$draft->setCaseTitle($cases['DEL_TITLE']);
|
$draft->setCaseTitle($title);
|
||||||
// Get the data
|
// Get the data
|
||||||
$res = $draft->getData();
|
$res = $draft->getData();
|
||||||
// Asserts
|
// Asserts
|
||||||
@@ -200,7 +201,7 @@ class DraftTest extends TestCase
|
|||||||
* It tests the getData method using order by column
|
* It tests the getData method using order by column
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -230,6 +231,7 @@ class DraftTest extends TestCase
|
|||||||
* It tests the getPagingCounters() method
|
* It tests the getPagingCounters() method
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getPagingCounters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getPagingCounters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_get_paging_counters_method()
|
public function it_should_test_get_paging_counters_method()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class InboxTest extends TestCase
|
|||||||
* It tests the getData method without filters
|
* It tests the getData method without filters
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_get_result_without_filters()
|
public function it_get_result_without_filters()
|
||||||
@@ -102,7 +102,7 @@ class InboxTest extends TestCase
|
|||||||
* It tests the getData method with processId filter
|
* It tests the getData method with processId filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -123,7 +123,7 @@ class InboxTest extends TestCase
|
|||||||
* It tests the getData method with case number filter
|
* It tests the getData method with case number filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -144,7 +144,7 @@ class InboxTest extends TestCase
|
|||||||
* It tests the getData method with taskId filter
|
* It tests the getData method with taskId filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -165,7 +165,7 @@ class InboxTest extends TestCase
|
|||||||
* It tests the getData method with case title filter
|
* It tests the getData method with case title filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -173,25 +173,26 @@ class InboxTest extends TestCase
|
|||||||
{
|
{
|
||||||
// Create factories related to the to_do cases
|
// Create factories related to the to_do cases
|
||||||
$cases = $this->createInbox();
|
$cases = $this->createInbox();
|
||||||
|
$usrId = $cases->USR_ID;
|
||||||
|
$title = $cases->DEL_TITLE;
|
||||||
// We need to commit the records inserted because is needed for the "fulltext" index
|
// We need to commit the records inserted because is needed for the "fulltext" index
|
||||||
DB::commit();
|
DB::commit();
|
||||||
// Create new Inbox object
|
// Create new Inbox object
|
||||||
$inbox = new Inbox();
|
$inbox = new Inbox();
|
||||||
$inbox->setUserUid($cases['USR_UID']);
|
$inbox->setUserId($usrId);
|
||||||
$inbox->setUserId($cases['USR_ID']);
|
|
||||||
// Set the title
|
// Set the title
|
||||||
$inbox->setCaseTitle($cases['DEL_TITLE']);
|
$inbox->setCaseTitle($title);
|
||||||
// Get the data
|
// Get the data
|
||||||
$res = $inbox->getData();
|
$result = $inbox->getData();
|
||||||
// Asserts
|
// Asserts
|
||||||
$this->assertNotEmpty($res);
|
$this->assertNotEmpty($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData method using order by column
|
* It tests the getData method using order by column
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -221,6 +222,7 @@ class InboxTest extends TestCase
|
|||||||
* It tests the getPagingCounters() method
|
* It tests the getPagingCounters() method
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getPagingCounters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getPagingCounters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_get_paging_counters_method()
|
public function it_should_test_get_paging_counters_method()
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class ParticipatedTest extends TestCase
|
|||||||
* It tests the getData method without filters
|
* It tests the getData method without filters
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_get_result_without_filters()
|
public function it_get_result_without_filters()
|
||||||
@@ -105,7 +105,7 @@ class ParticipatedTest extends TestCase
|
|||||||
* It tests the getData method with specific filter StartedByMe
|
* It tests the getData method with specific filter StartedByMe
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -133,7 +133,7 @@ class ParticipatedTest extends TestCase
|
|||||||
* It tests the getData method with specific filter CompletedByMe
|
* It tests the getData method with specific filter CompletedByMe
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -161,7 +161,7 @@ class ParticipatedTest extends TestCase
|
|||||||
* It tests the getData method with processId filter
|
* It tests the getData method with processId filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -191,7 +191,7 @@ class ParticipatedTest extends TestCase
|
|||||||
* It tests the getData method with processId filter
|
* It tests the getData method with processId filter
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -245,6 +245,7 @@ class ParticipatedTest extends TestCase
|
|||||||
* It tests the getPagingCounters() method
|
* It tests the getPagingCounters() method
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getPagingCounters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getPagingCounters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_get_paging_counters_method()
|
public function it_should_test_get_paging_counters_method()
|
||||||
|
|||||||
@@ -307,10 +307,28 @@ class PausedTest extends TestCase
|
|||||||
$this->assertNotEmpty($res);
|
$this->assertNotEmpty($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCounter() method
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCounter()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_test_count()
|
||||||
|
{
|
||||||
|
$cases = $this->createMultiplePaused(3);
|
||||||
|
$paused = new Paused();
|
||||||
|
$paused->setUserId($cases->USR_ID);
|
||||||
|
$paused->setUserUid($cases->USR_UID);
|
||||||
|
|
||||||
|
$res = $paused->getCounter();
|
||||||
|
$this->assertEquals(3, $res);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getPagingCounters() method
|
* It tests the getPagingCounters() method
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getPagingCounters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getPagingCounters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_get_paging_counters_method()
|
public function it_should_test_get_paging_counters_method()
|
||||||
|
|||||||
@@ -80,6 +80,51 @@ class SearchTest extends TestCase
|
|||||||
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
|
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getData with specific case numbers
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_specific_cases()
|
||||||
|
{
|
||||||
|
// Create factories related to the delegation cases
|
||||||
|
$cases = $this->createSearch();
|
||||||
|
// Create new Search object
|
||||||
|
$search = new Search();
|
||||||
|
$search->setCasesNumbers([$cases[0]->APP_NUMBER]);
|
||||||
|
// Set order by column value
|
||||||
|
$search->setOrderByColumn('APP_NUMBER');
|
||||||
|
$result = $search->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getData with specific case numbers
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_filter_by_range_cases()
|
||||||
|
{
|
||||||
|
// Create factories related to the delegation cases
|
||||||
|
$cases = $this->createSearch();
|
||||||
|
// Create new Search object
|
||||||
|
$search = new Search();
|
||||||
|
$rangeOfCases = $cases[0]->APP_NUMBER . "-" . $cases[0]->APP_NUMBER;
|
||||||
|
$search->setRangeCasesFromTo([$rangeOfCases]);
|
||||||
|
// Set order by column value
|
||||||
|
$search->setOrderByColumn('APP_NUMBER');
|
||||||
|
$result = $search->getData();
|
||||||
|
// This assert that the expected numbers of results are returned
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the getData with process
|
* It tests the getData with process
|
||||||
*
|
*
|
||||||
@@ -199,7 +244,7 @@ class SearchTest extends TestCase
|
|||||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getCounter()
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getCounter()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_should_test_the_counter_for_search()
|
public function it_get_counter()
|
||||||
{
|
{
|
||||||
// Create factories related to the delegation cases
|
// Create factories related to the delegation cases
|
||||||
$cases = $this->createSearch();
|
$cases = $this->createSearch();
|
||||||
@@ -208,6 +253,27 @@ class SearchTest extends TestCase
|
|||||||
// Set order by column value
|
// Set order by column value
|
||||||
$search->setOrderByColumn('APP_NUMBER');
|
$search->setOrderByColumn('APP_NUMBER');
|
||||||
$total = $search->getCounter();
|
$total = $search->getCounter();
|
||||||
$this->assertEquals(count($cases), $total);
|
// The count for search was disabled for performance issues
|
||||||
|
$this->assertEquals($total, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getPagingCounters method
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::getPagingCounters()
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_the_counter_for_search()
|
||||||
|
{
|
||||||
|
// Create factories related to the delegation cases
|
||||||
|
$cases = $this->createSearch();
|
||||||
|
// Create new Search object
|
||||||
|
$search = new Search();
|
||||||
|
// Set order by column value
|
||||||
|
$search->setOrderByColumn('APP_NUMBER');
|
||||||
|
$total = $search->getPagingCounters();
|
||||||
|
// The count for search was disabled for performance issues
|
||||||
|
$this->assertEquals($total, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,7 +400,7 @@ class SupervisingTest extends TestCase
|
|||||||
* Tests the filter by APP_NUMBER
|
* Tests the filter by APP_NUMBER
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -426,7 +426,7 @@ class SupervisingTest extends TestCase
|
|||||||
* Tests the filter by process
|
* Tests the filter by process
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -450,7 +450,7 @@ class SupervisingTest extends TestCase
|
|||||||
* Tests the filter by process
|
* Tests the filter by process
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -474,7 +474,7 @@ class SupervisingTest extends TestCase
|
|||||||
* It tests the getData method with case title filter
|
* 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\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -482,16 +482,19 @@ class SupervisingTest extends TestCase
|
|||||||
{
|
{
|
||||||
// Create factories related to the to_do cases
|
// Create factories related to the to_do cases
|
||||||
$cases = $this->createSupervising();
|
$cases = $this->createSupervising();
|
||||||
|
$usrUid = $cases->USR_UID;
|
||||||
|
$usrId = $cases->USR_ID;
|
||||||
|
$title = $cases->DEL_TITLE;
|
||||||
// We need to commit the records inserted because is needed for the "fulltext" index
|
// We need to commit the records inserted because is needed for the "fulltext" index
|
||||||
DB::commit();
|
DB::commit();
|
||||||
// Create new Inbox object
|
// Create new Inbox object
|
||||||
$supervising = new Supervising();
|
$supervising = new Supervising();
|
||||||
// Set the user UID
|
// Set the user UID
|
||||||
$supervising->setUserUid($cases->USR_UID);
|
$supervising->setUserUid($usrUid);
|
||||||
// Set the user ID
|
// Set the user ID
|
||||||
$supervising->setUserId($cases->USR_ID);
|
$supervising->setUserId($usrId);
|
||||||
// Set the title
|
// Set the title
|
||||||
$supervising->setCaseTitle($cases->DEL_TITLE);
|
$supervising->setCaseTitle($title);
|
||||||
// Get the data
|
// Get the data
|
||||||
$res = $supervising->getData();
|
$res = $supervising->getData();
|
||||||
// Asserts
|
// Asserts
|
||||||
@@ -502,7 +505,7 @@ class SupervisingTest extends TestCase
|
|||||||
* Tests the order by value
|
* Tests the order by value
|
||||||
*
|
*
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
|
||||||
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -528,9 +531,8 @@ class SupervisingTest extends TestCase
|
|||||||
//Set the order by value
|
//Set the order by value
|
||||||
$Supervising->setOrderByColumn($columnsView[$index]);
|
$Supervising->setOrderByColumn($columnsView[$index]);
|
||||||
//Call the getData method
|
//Call the getData method
|
||||||
$res = $Supervising->getData();
|
$result = $Supervising->getData();
|
||||||
$this->assertCount(3, $res);
|
$this->assertNotEmpty($result);
|
||||||
$this->assertTrue($res[0]['APP_NUMBER'] > $res[1]['APP_NUMBER']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,15 @@ class ApplicationTest extends TestCase
|
|||||||
{
|
{
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up function.
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
Application::query()->delete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test belongs to APP_CUR_USER
|
* Test belongs to APP_CUR_USER
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class DelegationTest extends TestCase
|
|||||||
public function it_return_scope_delegate_date_from()
|
public function it_return_scope_delegate_date_from()
|
||||||
{
|
{
|
||||||
$table = factory(Delegation::class)->states('foreign_keys')->create();
|
$table = factory(Delegation::class)->states('foreign_keys')->create();
|
||||||
$this->assertCount(1, $table->delegateDateFrom($table->DEL_DELEGATE_DATE->format("Y-m-d"))->get());
|
$this->assertCount(1, $table->delegateDateFrom($table->DEL_DELEGATE_DATE->format("Y-m-d H:i:s"))->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,7 +121,7 @@ class DelegationTest extends TestCase
|
|||||||
public function it_return_scope_delegate_date_to()
|
public function it_return_scope_delegate_date_to()
|
||||||
{
|
{
|
||||||
$table = factory(Delegation::class)->states('foreign_keys')->create();
|
$table = factory(Delegation::class)->states('foreign_keys')->create();
|
||||||
$this->assertCount(1, $table->delegateDateTo($table->DEL_DELEGATE_DATE->format("Y-m-d"))->get());
|
$this->assertCount(1, $table->delegateDateTo($table->DEL_DELEGATE_DATE->format("Y-m-d H:i:s"))->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -498,7 +498,7 @@ class DelegationTest extends TestCase
|
|||||||
// Get first page, the minor case title
|
// Get first page, the minor case title
|
||||||
$results = Delegation::search(null, 0, 2, null, null, null, 'ASC', 'APP_TITLE');
|
$results = Delegation::search(null, 0, 2, null, null, null, 'ASC', 'APP_TITLE');
|
||||||
$this->assertCount(2, $results['data']);
|
$this->assertCount(2, $results['data']);
|
||||||
$this->assertGreaterThan($results['data'][0]['APP_TITLE'], $results['data'][1]['APP_TITLE']);
|
$this->assertGreaterThanOrEqual($results['data'][0]['APP_TITLE'], $results['data'][1]['APP_TITLE']);
|
||||||
// Get first page, the major case title
|
// Get first page, the major case title
|
||||||
$results = Delegation::search(null, 0, 2, null, null, null, 'DESC', 'APP_TITLE');
|
$results = Delegation::search(null, 0, 2, null, null, null, 'DESC', 'APP_TITLE');
|
||||||
$this->assertCount(2, $results['data']);
|
$this->assertCount(2, $results['data']);
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Tests\unit\workflow\src\ProcessMaker\Model;
|
|
||||||
|
|
||||||
use ProcessMaker\Model\ListUnassigned;
|
|
||||||
use ProcessMaker\Model\Process;
|
|
||||||
use ProcessMaker\Model\ProcessCategory;
|
|
||||||
use ProcessMaker\Model\Task;
|
|
||||||
use ProcessMaker\Model\TaskUser;
|
|
||||||
use ProcessMaker\Model\User;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ListUnassignedTest
|
|
||||||
*
|
|
||||||
* @coversDefaultClass \ProcessMaker\Model\ListUnassigned
|
|
||||||
*/
|
|
||||||
class ListUnassignedTest extends TestCase
|
|
||||||
{
|
|
||||||
// The ListUnassigned class was deprecated in Release 3.6.0
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -10,6 +10,15 @@ class UserTest extends TestCase
|
|||||||
{
|
{
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up function.
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
User::query()->delete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the users filters scope with the usr uid filter
|
* Tests the users filters scope with the usr uid filter
|
||||||
*
|
*
|
||||||
@@ -110,9 +119,13 @@ class UserTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Assertions
|
// Assertions
|
||||||
$this->assertCount(4, User::getUsersForHome());
|
// Only will considerate the actives
|
||||||
|
$this->assertCount(3, User::getUsersForHome());
|
||||||
|
// Only will considerate the name Smith
|
||||||
$this->assertCount(3, User::getUsersForHome('Smith'));
|
$this->assertCount(3, User::getUsersForHome('Smith'));
|
||||||
$this->assertCount(4, User::getUsersForHome(null, null, 2));
|
// Only will considerate by default the actives
|
||||||
|
$this->assertCount(3, User::getUsersForHome(null, null, 2));
|
||||||
|
// Only will considerate by default the actives and limit
|
||||||
$this->assertCount(1, User::getUsersForHome(null, 2, 1));
|
$this->assertCount(1, User::getUsersForHome(null, 2, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace ProcessMaker\BusinessModel\Cases;
|
|
||||||
|
|
||||||
use ProcessMaker\Model\Delegation;
|
|
||||||
|
|
||||||
class Reassign extends AbstractCases
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the data corresponding to Reassign
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getData()
|
|
||||||
{
|
|
||||||
// Start the query for get the cases related to the user
|
|
||||||
$query = Delegation::query()->select();
|
|
||||||
|
|
||||||
// Scope that sets the queries for reassign
|
|
||||||
if (!empty($this->getUserId())) {
|
|
||||||
$query->inbox($this->getUserId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scope to search for an specific process
|
|
||||||
if (!empty($this->getProcessId())) {
|
|
||||||
$query->processId($this->getProcessId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// The order by clause
|
|
||||||
$query->orderBy($this->getOrderByColumn(), $this->getOrderDirection());
|
|
||||||
|
|
||||||
// The limit by clause
|
|
||||||
$query->offset($this->getOffset())->limit($this->getLimit());
|
|
||||||
|
|
||||||
// Execute the query
|
|
||||||
$results = $query->get();
|
|
||||||
|
|
||||||
// Return the values as an array format
|
|
||||||
return $results->values()->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the number of rows corresponding to the List Inbox
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getCounter()
|
|
||||||
{
|
|
||||||
$query = Delegation::query()->select();
|
|
||||||
|
|
||||||
// Scope that sets the queries for reassign
|
|
||||||
if (!empty($this->getUserId())) {
|
|
||||||
$query->inbox($this->getUserId());
|
|
||||||
} else {
|
|
||||||
// Scope that sets the queries for List Inbox
|
|
||||||
$query->inboxWithoutUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the number of rows
|
|
||||||
return $query->count();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user