PMCORE-3515
This commit is contained in:
@@ -28,6 +28,7 @@ class DraftTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Delegation::truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -881,4 +882,18 @@ class DraftTest extends TestCase
|
||||
$res = $draft->getCasesRisk($process->PRO_ID, null, null, 'OVERDUE');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCounterMetrics() method
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCounterMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_counter_metrics()
|
||||
{
|
||||
$this->createDraft();
|
||||
$draft = new Draft();
|
||||
$result = $draft->getCounterMetrics();
|
||||
$this->assertTrue($result > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,14 @@ class InboxTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Delegation::truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method tearDown
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,9 +280,14 @@ class InboxTest extends TestCase
|
||||
public function it_filter_by_thread_title()
|
||||
{
|
||||
// Create factories related to the to_do cases
|
||||
$cases = $this->createInbox();
|
||||
$usrId = $cases->USR_ID;
|
||||
$title = $cases->DEL_TITLE;
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_PREVIOUS' => 1,
|
||||
'DEL_INDEX' => 2,
|
||||
'DEL_TITLE' => 'Test',
|
||||
]);
|
||||
$usrId = $delegation->USR_ID;
|
||||
$title = 'Test';
|
||||
// We need to commit the records inserted because is needed for the "fulltext" index
|
||||
DB::commit();
|
||||
// Create new Inbox object
|
||||
@@ -830,4 +843,18 @@ class InboxTest extends TestCase
|
||||
$res = $inbox->getCasesRisk($process->PRO_ID, null, null, "OVERDUE");
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCounterMetrics method
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCounterMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_counter_metrics()
|
||||
{
|
||||
$this->createInbox();
|
||||
$inbox = new Inbox();
|
||||
$res = $inbox->getCounterMetrics();
|
||||
$this->assertTrue($res > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class PausedTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Delegation::truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -911,4 +912,19 @@ class PausedTest extends TestCase
|
||||
$res = $paused->getCasesRisk($process1->PRO_ID, null, null, 'OVERDUE');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCounterMetrics() method
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCounterMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_counter_metrics()
|
||||
{
|
||||
$this->createMultiplePaused(3);
|
||||
$paused = new Paused();
|
||||
|
||||
$res = $paused->getCounterMetrics();
|
||||
$this->assertTrue($res > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ class UnassignedTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Delegation::truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -951,4 +952,18 @@ class UnassignedTest extends TestCase
|
||||
$res = $unassigned->getCasesRisk($process1->PRO_ID, null, null, 'OVERDUE');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This the getCounterMetrics method
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCounterMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_counter_metrics()
|
||||
{
|
||||
$this->createSelfServiceUserOrGroup();
|
||||
$unassigned = new Unassigned;
|
||||
$result = $unassigned->getCounterMetrics();
|
||||
$this->assertTrue($result > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1154,7 +1154,11 @@ class DelegationTest extends TestCase
|
||||
*/
|
||||
public function it_should_search_and_filter_by_app_title()
|
||||
{
|
||||
$delegations = factory(Delegation::class, 1)->states('foreign_keys')->create();
|
||||
$delegations = factory(Delegation::class, 1)->states('foreign_keys')->create([
|
||||
'APP_NUMBER' => function () {
|
||||
return factory(Application::class)->create()->APP_NUMBER;
|
||||
}
|
||||
]);
|
||||
$title = $delegations->last()->DEL_TITLE;
|
||||
// We need to commit the records inserted because is needed for the "fulltext" index
|
||||
DB::commit();
|
||||
@@ -3596,4 +3600,83 @@ class DelegationTest extends TestCase
|
||||
$res = $table->joinApplication()->participatedUser($table->USR_ID)->get();
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the scopeInboxMetrics
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Delegation::scopeInboxMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_scope_inbox_metrics()
|
||||
{
|
||||
$application = factory(Application::class)->states('todo')->create();
|
||||
$table = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'APP_UID' => $application->APP_UID,
|
||||
]);
|
||||
$res = $table->inboxMetrics()->get();
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the scopeDraftMetrics
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Delegation::scopeDraftMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_scope_draft_metrics()
|
||||
{
|
||||
$application = factory(Application::class)->states('draft')->create();
|
||||
$table = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'APP_UID' => $application->APP_UID,
|
||||
]);
|
||||
$res = $table->draftMetrics()->get();
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the scopePausedMetrics
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Delegation::scopePausedMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_scope_paused_metrics()
|
||||
{
|
||||
$application = factory(Application::class)->states('paused')->create();
|
||||
$appDelay = factory(AppDelay::class)->states('paused_foreign_keys')->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'APP_UID' => $application->APP_UID,
|
||||
]);
|
||||
$table = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'DEL_INDEX' => $appDelay->APP_DEL_INDEX,
|
||||
]);
|
||||
$res = $table->pausedMetrics()->get();
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the scopeSelfServiceMetrics
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Delegation::scopeSelfServiceMetrics()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_scope_self_service_metrics()
|
||||
{
|
||||
$application = factory(Application::class)->states('paused')->create();
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||
]);
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_ID' => 0,
|
||||
]);
|
||||
$res = $delegation->selfServiceMetrics()->get();
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user