conflicts
This commit is contained in:
@@ -5,6 +5,7 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -67,8 +68,9 @@ class DelegationTest extends TestCase
|
||||
factory(Process::class,1)->create();
|
||||
$application = factory(Application::class, 1)->create([
|
||||
'APP_NUMBER' => 2001,
|
||||
'APP_STATUS_ID' => 1
|
||||
]);//DRAFT
|
||||
'APP_STATUS_ID' => 1,
|
||||
'APP_STATUS' => 'DRAFT'
|
||||
]);
|
||||
factory(Delegation::class, 51)->create([
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
]);
|
||||
@@ -95,9 +97,9 @@ class DelegationTest extends TestCase
|
||||
factory(Process::class,1)->create();
|
||||
$application = factory(Application::class, 1)->create([
|
||||
'APP_NUMBER' => 2001,
|
||||
'APP_STATUS_ID' => 2
|
||||
]);//DRAFT
|
||||
|
||||
'APP_STATUS_ID' => 2,
|
||||
'APP_STATUS' => 'TO_DO'
|
||||
]);
|
||||
factory(Delegation::class, 51)->create([
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
]);
|
||||
@@ -124,13 +126,15 @@ class DelegationTest extends TestCase
|
||||
factory(Process::class,1)->create();
|
||||
$application = factory(Application::class, 1)->create([
|
||||
'APP_NUMBER' => 2001,
|
||||
'APP_STATUS_ID' => 3
|
||||
]);//DRAFT
|
||||
'APP_STATUS_ID' => 3,
|
||||
'APP_STATUS' => 'COMPLETED',
|
||||
]);
|
||||
|
||||
factory(Delegation::class, 51)->create([
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||
'DEL_LAST_INDEX' => 1
|
||||
]);
|
||||
// Review the filter by status DRAFT
|
||||
// Review the filter by status COMPLETED
|
||||
// Get first page, which is 25
|
||||
$results = Delegation::search(null, 0, 25, null, null, $application[0]->APP_STATUS_ID);
|
||||
$this->assertCount(25, $results['data']);
|
||||
@@ -153,13 +157,15 @@ class DelegationTest extends TestCase
|
||||
factory(Process::class,1)->create();
|
||||
$application = factory(Application::class, 1)->create([
|
||||
'APP_NUMBER' => 2001,
|
||||
'APP_STATUS_ID' => 4
|
||||
]);//DRAFT
|
||||
'APP_STATUS_ID' => 4,
|
||||
'APP_STATUS' => 'CANCELLED'
|
||||
]);
|
||||
|
||||
factory(Delegation::class, 51)->create([
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||
'DEL_LAST_INDEX' => 1
|
||||
]);
|
||||
// Review the filter by status DRAFT
|
||||
// Review the filter by status CANCELLED
|
||||
// Get first page, which is 25
|
||||
$results = Delegation::search(null, 0, 25, null, null, $application[0]->APP_STATUS_ID);
|
||||
$this->assertCount(25, $results['data']);
|
||||
@@ -235,7 +241,41 @@ class DelegationTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures ordering ascending and descending works by user
|
||||
* This ensures ordering ascending works by case title
|
||||
* @test
|
||||
*/
|
||||
public function it_should_sort_by_case_title()
|
||||
{
|
||||
factory(User::class,100)->create();
|
||||
factory(Process::class,1)->create();
|
||||
$application = factory(Application::class, 1)->create([
|
||||
'APP_NUMBER' => 2001,
|
||||
'APP_TITLE' => 'Request by Thomas'
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
]);
|
||||
$application = factory(Application::class, 1)->create([
|
||||
'APP_NUMBER' => 30002,
|
||||
'APP_TITLE' => 'Request by Ariel'
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
]);
|
||||
// Get first page, the minor case id
|
||||
$results = Delegation::search(null, 0, 25, null, null, null, 'ASC', 'APP_TITLE');
|
||||
$this->assertCount(2, $results['data']);
|
||||
$this->assertEquals('Request by Ariel', $results['data'][0]['APP_TITLE']);
|
||||
$this->assertEquals('Request by Thomas', $results['data'][1]['APP_TITLE']);
|
||||
// Get first page, the major case id
|
||||
$results = Delegation::search(null, 0, 25, null, null, null, 'DESC', 'APP_TITLE');
|
||||
$this->assertCount(2, $results['data']);
|
||||
$this->assertEquals('Request by Thomas', $results['data'][0]['APP_TITLE']);
|
||||
$this->assertEquals('Request by Ariel', $results['data'][1]['APP_TITLE']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures ordering ascending and descending works by current user
|
||||
* @test
|
||||
*/
|
||||
public function it_should_sort_by_user()
|
||||
@@ -280,21 +320,69 @@ class DelegationTest extends TestCase
|
||||
*/
|
||||
public function it_should_return_categories_of_data()
|
||||
{
|
||||
/*factory(User::class,100)->create();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks to make sure filter by process is working properly
|
||||
* @test
|
||||
*/
|
||||
public function it_should_return_data_issue()
|
||||
{
|
||||
factory(User::class,100)->create();
|
||||
// Create a threads over the process
|
||||
$process = factory(Process::class, 1)->create([
|
||||
'PRO_ID' => 1
|
||||
]);
|
||||
factory(Delegation::class, 51)->create([
|
||||
$application = factory(Application::class, 1)->create([
|
||||
'APP_NUMBER' => 1,
|
||||
'APP_TITLE' => 'Request by Thomas',
|
||||
'APP_STATUS_ID' => 2,
|
||||
'APP_STATUS' => 'TO_DO'
|
||||
]);
|
||||
// Create a user Gary in a thread
|
||||
$user = factory(User::class)->create([
|
||||
'USR_USERNAME' => 'gary',
|
||||
'USR_LASTNAME' => 'Gary',
|
||||
'USR_FIRSTNAME' => 'Bailey',
|
||||
]);
|
||||
// Create a thread with the user Gary
|
||||
factory(Delegation::class, 1)->create([
|
||||
'PRO_ID' => $process[0]->id,
|
||||
'USR_ID' => $user->id,
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
]);
|
||||
|
||||
// Define a dummy task
|
||||
$task = factory(Task::class, 1)->create([
|
||||
'TAS_ID' => 1,
|
||||
'TAS_TYPE' => 'INTERMEDIATE-THROW'
|
||||
]);
|
||||
// Create a thread with the dummy task this does not need a user
|
||||
factory(Delegation::class, 1)->create([
|
||||
'PRO_ID' => $process[0]->id,
|
||||
'USR_ID' => 0,
|
||||
'TAS_ID' => $task[0]->id,
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
]);
|
||||
// Create a user Paul in a thread
|
||||
$user = factory(User::class)->create([
|
||||
'USR_USERNAME' => 'Paul',
|
||||
'USR_LASTNAME' => 'Griffis',
|
||||
'USR_FIRSTNAME' => 'paul',
|
||||
]);
|
||||
// Create a thread with the user Paul
|
||||
factory(Delegation::class, 1)->create([
|
||||
'PRO_ID' => $process[0]->id,
|
||||
'USR_ID' => $user->id,
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER
|
||||
]);
|
||||
// Create others delegations
|
||||
factory(Delegation::class, 24)->create([
|
||||
'PRO_ID' => $process[0]->id
|
||||
]);
|
||||
// Get first page, which is 25
|
||||
$results = Delegation::search(null, 0, 25, null, $process[0]->id);
|
||||
$this->assertCount(25, $results['data']);
|
||||
// Get second page, which is 25 results
|
||||
$results = Delegation::search(null, 25, 25,null, $process[0]->id);
|
||||
$this->assertCount(25, $results['data']);
|
||||
// Get third page, which is only 1 result
|
||||
$results = Delegation::search(null, 50, 25,null, $process[0]->id);
|
||||
$this->assertCount(1, $results['data']);*/
|
||||
// Get first page, which is 25 of 26
|
||||
$results = Delegation::search(null, 0, 10, null, $process[0]->id, null, 'ASC', 'APP_NUMBER');
|
||||
$this->assertCount(10, $results['data']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user