-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMultiBranchProcessTest.php
More file actions
129 lines (117 loc) · 4.11 KB
/
Copy pathMultiBranchProcessTest.php
File metadata and controls
129 lines (117 loc) · 4.11 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php /** @noinspection PhpFullyQualifiedNameUsageInspection */
declare(strict_types=1);
/*
* This file is part of the CleverAge/ProcessBundle package.
*
* Copyright (C) 2017-2021 Clever-Age
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CleverAge\ProcessBundle\Tests;
/**
* Assert multiple branch processes are correctly checked
*/
class MultiBranchProcessTest extends AbstractProcessTest
{
/**
* Assert only one branch is called
*/
public function testMultiBranchProcess()
{
$this->processManager->execute('test.multi_branch_process_first');
$this->assertDataQueue(
[
[
'task' => 'data1',
'value' => 'ok',
],
],
'test.multi_branch_process_first'
);
$this->processManager->execute('test.multi_branch_process_entry');
$this->assertDataQueue(
[
[
'task' => 'data2',
'value' => 'ok',
],
],
'test.multi_branch_process_entry'
);
$this->processManager->execute('test.multi_branch_process_entry_reversed');
$this->assertDataQueue(
[
[
'task' => 'data2',
'value' => 'ok',
],
],
'test.multi_branch_process_entry'
);
$this->processManager->execute('test.multi_branch_process_end');
$this->assertDataQueue(
[
[
'task' => 'data2',
'value' => 'ok',
],
],
'test.multi_branch_process_end'
);
$this->processManager->execute('test.multi_branch_process_entry_end');
$this->assertDataQueue(
[
[
'task' => 'data2',
'value' => 'ok',
],
],
'test.multi_branch_process_entry_end'
);
}
public function testMainGroupOrder()
{
$process = $this->processConfigurationRegistry->getProcessConfiguration('test.multi_branch_process_first');
self::assertEquals(
['data1', 'pushDataEvent1'],
$process->getMainTaskGroup(),
'Failed testing task order with process test.multi_branch_process_first'
);
$process = $this->processConfigurationRegistry->getProcessConfiguration('test.multi_branch_process_entry');
self::assertEquals(
['data2', 'pushDataEvent2'],
$process->getMainTaskGroup(),
'Failed testing task order with process test.multi_branch_process_entry'
);
$process = $this->processConfigurationRegistry->getProcessConfiguration(
'test.multi_branch_process_entry_reversed'
);
self::assertEquals(
['data2', 'pushDataEvent2'],
$process->getMainTaskGroup(),
'Failed testing task order with process test.multi_branch_process_entry_reversed'
);
$process = $this->processConfigurationRegistry->getProcessConfiguration('test.multi_branch_process_end');
self::assertEquals(
['data2', 'pushDataEvent2'],
$process->getMainTaskGroup(),
'Failed testing task order with process test.multi_branch_process_end'
);
$process = $this->processConfigurationRegistry->getProcessConfiguration('test.multi_branch_process_entry_end');
self::assertEquals(
['data2', 'pushDataEvent2'],
$process->getMainTaskGroup(),
'Failed testing task order with process test.multi_branch_process_entry_end'
);
}
/**
* Assert a task cannot be started if the process is not valid
*
* @expectedException \CleverAge\ProcessBundle\Exception\InvalidProcessConfigurationException
*/
public function testMultiBranchProcessError()
{
$this->processManager->execute('test.multi_branch_process_entry_end_error');
}
}