forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskTest.php
More file actions
40 lines (32 loc) · 1.19 KB
/
TaskTest.php
File metadata and controls
40 lines (32 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Tests\Resources;
use Tests\TestCase;
use ProcessMaker\Models\User;
use ProcessMaker\Jobs\ImportProcess;
use ProcessMaker\Facades\WorkflowManager;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Models\ProcessRequestToken;
use Tests\Feature\Shared\RequestHelper;
class TaskTest extends TestCase {
use RequestHelper;
public function testScreens()
{
$this->be($this->user);
$content = file_get_contents(
__DIR__ . '/../Fixtures/nested_screen_process.json'
);
$import = ImportProcess::dispatchNow($content);
$processRequest = WorkflowManager::triggerStartEvent(
$import->process,
$import->process->getDefinitions()->getEvent('node_1'),
[]
);
$task = $processRequest->tokens()->where('status', 'ACTIVE')->firstOrFail();
$url = route('api.tasks.show', [$task]);
$result = $this->apiCall('GET', $url, ['include'=>'screen']);
$json = $result->json();
$this->assertEquals('parent', $json['screen']['title']);
$this->assertCount(3, $json['screen']['nested']);
$this->assertEquals('child', $json['screen']['nested'][0]['title']);
}
}