Skip to content

Commit 91ed2eb

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: [Workflow] Add more tests
2 parents 89a9e9e + 8d6cb1c commit 91ed2eb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php

+29
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Workflow\Tests\Validator;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Workflow\Arc;
1516
use Symfony\Component\Workflow\Definition;
1617
use Symfony\Component\Workflow\Exception\InvalidDefinitionException;
1718
use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
@@ -55,4 +56,32 @@ public function testSameTransitionNameButNotSamePlace()
5556
// the test ensures that the validation does not fail (i.e. it does not throw any exceptions)
5657
$this->addToAssertionCount(1);
5758
}
59+
60+
public function testWithTooManyOutput()
61+
{
62+
$places = ['a', 'b', 'c'];
63+
$transitions = [
64+
new Transition('t1', 'a', ['b', 'c']),
65+
];
66+
$definition = new Definition($places, $transitions);
67+
68+
$this->expectException(InvalidDefinitionException::class);
69+
$this->expectExceptionMessage('The marking store of workflow "foo" cannot store many places. But the transition "t1" has too many output (2). Only one is accepted.');
70+
71+
(new WorkflowValidator(true))->validate($definition, 'foo');
72+
}
73+
74+
public function testWithTooManyInitialPlaces()
75+
{
76+
$places = ['a', 'b', 'c'];
77+
$transitions = [
78+
new Transition('t1', 'a', 'b'),
79+
];
80+
$definition = new Definition($places, $transitions, ['a', 'b']);
81+
82+
$this->expectException(InvalidDefinitionException::class);
83+
$this->expectExceptionMessage('The marking store of workflow "foo" cannot store many places. But the definition has 2 initial places. Only one is supported.');
84+
85+
(new WorkflowValidator(true))->validate($definition, 'foo');
86+
}
5887
}

0 commit comments

Comments
 (0)