Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3bfb779

Browse filesBrowse files
committed
[Workflow] Add more tests
1 parent 345e22f commit 3bfb779
Copy full SHA for 3bfb779

File tree

Expand file treeCollapse file tree

1 file changed

+32
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+32
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php
+32-2Lines changed: 32 additions & 2 deletions
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;
@@ -24,8 +25,6 @@ class WorkflowValidatorTest extends TestCase
2425

2526
public function testWorkflowWithInvalidNames()
2627
{
27-
$this->expectException(InvalidDefinitionException::class);
28-
$this->expectExceptionMessage('All transitions for a place must have an unique name. Multiple transitions named "t1" where found for place "a" in workflow "foo".');
2928
$places = range('a', 'c');
3029

3130
$transitions = [];
@@ -35,6 +34,9 @@ public function testWorkflowWithInvalidNames()
3534

3635
$definition = new Definition($places, $transitions);
3736

37+
$this->expectException(InvalidDefinitionException::class);
38+
$this->expectExceptionMessage('All transitions for a place must have an unique name. Multiple transitions named "t1" where found for place "a" in workflow "foo".');
39+
3840
(new WorkflowValidator())->validate($definition, 'foo');
3941
}
4042

@@ -54,4 +56,32 @@ public function testSameTransitionNameButNotSamePlace()
5456
// the test ensures that the validation does not fail (i.e. it does not throw any exceptions)
5557
$this->addToAssertionCount(1);
5658
}
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+
}
5787
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.