1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Wesnick\WorkflowBundle\Tests\Validation; |
4
|
|
|
|
5
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
6
|
|
|
use Symfony\Component\Workflow\MarkingStore\MultipleStateMarkingStore; |
7
|
|
|
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait; |
|
|
|
|
8
|
|
|
use Symfony\Component\Workflow\Transition; |
9
|
|
|
use Symfony\Component\Workflow\Workflow; |
10
|
|
|
use Wesnick\WorkflowBundle\Tests\Fixtures\ArticleWithWorkflow; |
11
|
|
|
use Wesnick\WorkflowBundle\Tests\Fixtures\StateProviderWithWorkflow; |
12
|
|
|
use Wesnick\WorkflowBundle\Validation\ChainedWorkflowValidationStrategy; |
13
|
|
|
use Wesnick\WorkflowBundle\Validation\ValidationStateProviderStrategy; |
14
|
|
|
use Wesnick\WorkflowBundle\Validation\WorkflowValidationStrategy; |
15
|
|
|
|
16
|
|
|
class ChainedWorkflowValidationStrategyTest extends TestCase |
17
|
|
|
{ |
18
|
|
|
use WorkflowBuilderTrait; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @dataProvider validationSubjectProvider |
22
|
|
|
*/ |
23
|
|
|
public function testGetValidationGroupsForSubject($subject, Workflow $workflow, Transition $transition, array $result) |
24
|
|
|
{ |
25
|
|
|
$strategy = new ChainedWorkflowValidationStrategy([ |
26
|
|
|
new WorkflowValidationStrategy(), |
27
|
|
|
new ValidationStateProviderStrategy() |
28
|
|
|
]); |
29
|
|
|
|
30
|
|
|
$groups = $strategy->getValidationGroupsForSubject($subject, $workflow, $transition); |
31
|
|
|
$this->assertEquals($result, $groups); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function validationSubjectProvider() |
35
|
|
|
{ |
36
|
|
|
$definition = $this->createComplexWorkflowDefinition(); |
37
|
|
|
$transitions = $definition->getTransitions(); |
38
|
|
|
$getTransitionByName = function ($name) use ($transitions) { |
39
|
|
|
foreach ($transitions as $transition) { |
40
|
|
|
if ($transition->getName() === $name) { |
41
|
|
|
return $transition; |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
}; |
45
|
|
|
$workflow = new Workflow($definition, new MultipleStateMarkingStore()); |
|
|
|
|
46
|
|
|
|
47
|
|
|
yield [new ArticleWithWorkflow(), $workflow, $getTransitionByName('t1'), ['Default', 'unnamed', 'unnamed_b', 'unnamed_c']]; |
48
|
|
|
yield [new ArticleWithWorkflow(), $workflow, $getTransitionByName('t2'), ['Default', 'unnamed', 'unnamed_d']]; |
49
|
|
|
yield [new StateProviderWithWorkflow('blue'), $workflow, $getTransitionByName('t1'), ['Default', 'unnamed', 'unnamed_b', 'unnamed_c', 'b_blue', 'c_blue']]; |
50
|
|
|
yield [new StateProviderWithWorkflow('red'), $workflow, $getTransitionByName('t1'), ['Default', 'unnamed', 'unnamed_b', 'unnamed_c', 'b_red', 'c_red']]; |
51
|
|
|
yield [new StateProviderWithWorkflow('red'), $workflow, $getTransitionByName('t2'), ['Default', 'unnamed', 'unnamed_d', 'd_red']]; |
52
|
|
|
yield [new StateProviderWithWorkflow('green'), $workflow, $getTransitionByName('t2'), ['Default', 'unnamed', 'unnamed_d', 'd_green']]; |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths