forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessageTest.php
More file actions
47 lines (38 loc) · 1.28 KB
/
MessageTest.php
File metadata and controls
47 lines (38 loc) · 1.28 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
41
42
43
44
45
46
47
<?php
namespace Tests\Feature\Processes;
use ProcessMaker\Facades\WorkflowManager;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\Script;
use Tests\Feature\Shared\RequestHelper;
use Tests\TestCase;
class MessageTest extends TestCase
{
use RequestHelper;
public function setUpWithPersonalAccessClient()
{
$this->withPersonalAccessClient();
}
public function test()
{
$script = Script::factory()->create([
'language' => 'php',
'code' => '<?php return $config; ?>',
'run_as_user_id' => $this->user->id,
]);
$process = Process::factory()->create([
'bpmn' => str_replace(
'[script_id]',
$script->id,
file_get_contents(__DIR__ . '/../../Fixtures/message_test.bpmn')
),
]);
$definitions = $process->getDefinitions();
$startEvent = $definitions->getEvent('node_1');
$request = WorkflowManager::triggerStartEvent($process, $startEvent, []);
$request->refresh();
$this->assertEquals('COMPLETED', $request->status);
// Data should contain foo=>bar from the first pool but not
// bar=>baz from the other pool
$this->assertEquals(['foo' => 'bar'], $request->data);
}
}