PMCORE-3083

This commit is contained in:
Paula Quispe
2021-07-08 12:55:24 -04:00
parent 072b06d899
commit bb9e6b77b2
17 changed files with 439 additions and 43 deletions

View File

@@ -156,6 +156,49 @@ class DraftTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$draft = new Draft();
$draft->setUserId($cases['USR_ID']);
$draft->setCasesNumbers([$cases['APP_NUMBER']]);
$draft->setOrderByColumn('APP_NUMBER');
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_filter_by_range_cases()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$draft = new Draft();
$draft->setUserId($cases['USR_ID']);
$rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER'];
$draft->setRangeCasesFromTo([$rangeOfCases]);
$draft->setOrderByColumn('APP_NUMBER');
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with taskId filter
*

View File

@@ -150,6 +150,49 @@ class InboxTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
$inbox->setCasesNumbers([$cases->APP_NUMBER]);
$inbox->setOrderByColumn('APP_NUMBER');
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_filter_by_range_cases()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
$inbox->setRangeCasesFromTo([$rangeOfCases]);
$inbox->setOrderByColumn('APP_NUMBER');
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with taskId filter
*

View File

@@ -116,6 +116,7 @@ class ParticipatedTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseStatus()
* @test
*/
public function it_filter_by_started_by_me()
@@ -128,6 +129,8 @@ class ParticipatedTest extends TestCase
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Get only the TO_DO
$participated->setCaseStatus(2);
// Set the filter STARTED
$participated->setParticipatedStatus('STARTED');
// Set OrderBYColumn value
@@ -172,6 +175,7 @@ class ParticipatedTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setProcessId()
* @test
*/
public function it_filter_by_process()
@@ -196,12 +200,76 @@ class ParticipatedTest extends TestCase
$this->assertEquals(2, count($res));
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCasesNumbers()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases['USR_UID']);
// Set the user ID
$participated->setUserId($cases['USR_ID']);
// Set the case numbers
$participated->setCasesNumbers([$cases['APP_NUMBER']]);
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(2, count($res));
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setRangeCasesFromTo()
* @test
*/
public function it_filter_by_range_cases()
{
// 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 case numbers
$rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER'];
$participated->setRangeCasesFromTo([$rangeOfCases]);
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(2, count($res));
}
/**
* It tests the getData method with processId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseTitle()
* @test
*/
public function it_filter_by_thread_title()

View File

@@ -241,6 +241,32 @@ class PausedTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the paused cases
$cases = $this->createPaused();
//Create new Paused object
$paused = new Paused();
//Set the user UID
$paused->setUserUid($cases->USR_UID);
//Set the user ID
$paused->setUserId($cases->USR_ID);
//Set app number
$paused->setCasesNumbers([$cases->APP_NUMBER]);
//Call to getData method
$res = $paused->getData();
//This asserts there are results for the filtered app number
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with taskId filter
*

View File

@@ -351,11 +351,11 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
//Call the getData method
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(3, $res);
@@ -373,11 +373,11 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($user->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($user->USR_ID);
//Call the getData method
// Call the getData method
$res = $Supervising->getData();
// Asserts the result
$this->assertEmpty($res);
@@ -394,13 +394,13 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
//Call the getCounter method
// Call the getCounter method
$res = $Supervising->getCounter();
//Assert the counter
// Assert the counter
$this->assertEquals(3, $res);
}
@@ -410,6 +410,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseNumber()
* @test
*/
public function it_filter_by_app_number()
@@ -417,16 +418,74 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
// Set the case number
$Supervising->setCaseNumber($cases->APP_NUMBER);
//Call the getData method
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(1, $res);
//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]);
}
/**
* Tests the filter by APP_NUMBER
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseNumber()
* @test
*/
public function it_filter_by_specific_cases()
{
$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 case numbers
$Supervising->setCasesNumbers([$cases->APP_NUMBER]);
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(1, $res);
// Asserts that the result contains the app number searched
$this->assertContains($cases->APP_NUMBER, $res[0]);
}
/**
* Tests the filter by APP_NUMBER
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setRangeCasesFromTo()
* @test
*/
public function it_filter_by_range_cases()
{
$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 case numbers
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
$Supervising->setRangeCasesFromTo([$rangeOfCases]);
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(1, $res);
// Asserts that the result contains the app number searched
$this->assertContains($cases->APP_NUMBER, $res[0]);
}
@@ -436,6 +495,7 @@ class SupervisingTest extends TestCase
* @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()
@@ -460,6 +520,7 @@ class SupervisingTest extends TestCase
* @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()
@@ -484,6 +545,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseTitle()
* @test
*/
public function it_filter_by_thread_title()
@@ -515,6 +577,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setOrderByColumn()
* @test
*/
public function it_order_by_column()