|
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\Validation\WorkflowValidationStrategy; |
|
12
|
|
|
|
|
13
|
|
|
class WorkflowValidationStrategyTest extends TestCase |
|
14
|
|
|
{ |
|
15
|
|
|
use WorkflowBuilderTrait; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @dataProvider validationSubjectProvider |
|
19
|
|
|
*/ |
|
20
|
|
|
public function testGetValidationGroupsForSubject($subject, Workflow $workflow, Transition $transition, array $result) |
|
21
|
|
|
{ |
|
22
|
|
|
$strategy = new WorkflowValidationStrategy(); |
|
23
|
|
|
$groups = $strategy->getValidationGroupsForSubject($subject, $workflow, $transition); |
|
24
|
|
|
$this->assertEquals($result, $groups); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function validationSubjectProvider() |
|
28
|
|
|
{ |
|
29
|
|
|
$definition = $this->createComplexWorkflowDefinition(); |
|
30
|
|
|
$transitions = $definition->getTransitions(); |
|
31
|
|
|
$getTransitionByName = function ($name) use ($transitions) { |
|
32
|
|
|
foreach ($transitions as $transition) { |
|
33
|
|
|
if ($transition->getName() === $name) { |
|
34
|
|
|
return $transition; |
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
}; |
|
38
|
|
|
$workflow = new Workflow($definition, new MultipleStateMarkingStore()); |
|
39
|
|
|
|
|
40
|
|
|
yield [new ArticleWithWorkflow(), $workflow, $getTransitionByName('t1'), ['Default', 'unnamed', 'unnamed_b', 'unnamed_c']]; |
|
41
|
|
|
yield [new ArticleWithWorkflow(), $workflow, $getTransitionByName('t2'), ['Default', 'unnamed', 'unnamed_d']]; |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
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