|
12 | 12 | namespace Symfony\Component\Workflow\Tests\Validator;
|
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase;
|
| 15 | +use Symfony\Component\Workflow\Arc; |
15 | 16 | use Symfony\Component\Workflow\Definition;
|
16 | 17 | use Symfony\Component\Workflow\Exception\InvalidDefinitionException;
|
17 | 18 | use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait;
|
@@ -55,4 +56,32 @@ public function testSameTransitionNameButNotSamePlace()
|
55 | 56 | // the test ensures that the validation does not fail (i.e. it does not throw any exceptions)
|
56 | 57 | $this->addToAssertionCount(1);
|
57 | 58 | }
|
| 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 | + } |
58 | 87 | }
|
0 commit comments