8000 Merge branch '7.2' into 7.3 · sfmok/symfony@5276de0 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 5276de0

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: [Workflow] Add more tests [Validator] fix php doc
2 parents 19bb3a4 + 91ed2eb commit 5276de0

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

src/Symfony/Component/Validator/Constraints/Type.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class Type extends Constraint
3232
public string|array|null $type = null;
3333

3434
/**
35-
* @param string|string[]|array<string,mixed>|null $type The type(s) to enforce on the value
36-
* @param string[]|null $groups
37-
* @param array<string,mixed>|null $options
35+
* @param string|list<string>|array<string,mixed>|null $type The type(s) to enforce on the value
36+
* @param string[]|null $groups
37+
* @param array<string,mixed>|null $options
3838
*/
3939
#[HasNamedArguments]
4040
public function __construct(string|array|null $type, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null)

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

Lines changed: 29 additions & 0 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;
@@ -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)
0