File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
Tests/DependencyInjection Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -465,6 +465,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
465
465
->beforeNormalization ()
466
466
->always ()
467
467
->then (function ($ places ) {
468
+ if (!\is_array ($ places )) {
469
+ throw new InvalidConfigurationException ('The "places" option must be an array in workflow configuration. ' );
470
+ }
471
+
468
472
// It's an indexed array of shape ['place1', 'place2']
469
473
if (isset ($ places [0 ]) && \is_string ($ places [0 ])) {
470
474
return array_map (function (string $ place ) {
@@ -510,6 +514,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
510
514
->beforeNormalization ()
511
515
->always ()
512
516
->then (function ($ transitions ) {
517
+ if (!\is_array ($ transitions )) {
518
+ throw new InvalidConfigurationException ('The "transitions" option must be an array in workflow configuration. ' );
519
+ }
520
+
513
521
// It's an indexed array, we let the validation occur
514
522
if (isset ($ transitions [0 ]) && \is_array ($ transitions [0 ])) {
515
523
return $ transitions ;
Original file line number Diff line number Diff line change 6
6
7
7
<route id =" _webhook_controller" path =" /{type}" >
8
8
<default key =" _controller" >webhook.controller::handle</default >
9
+ <requirement key =" type" >.+</requirement >
9
10
</route >
10
11
</routes >
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Bundle \FrameworkBundle \Tests \DependencyInjection ;
13
13
14
+ use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
14
15
use Symfony \Component \Config \FileLocator ;
15
16
use Symfony \Component \DependencyInjection \ContainerBuilder ;
16
17
use Symfony \Component \DependencyInjection \Exception \LogicException ;
@@ -60,6 +61,36 @@ public function testAssetPackageCannotHavePathAndUrl()
60
61
});
61
62
}
62
63
64
+ public function testWorkflowValidationPlacesIsArray ()
65
+ {
66
+ $ this ->expectException (InvalidConfigurationException::class);
67
+ $ this ->expectExceptionMessage ('The "places" option must be an array in workflow configuration. ' );
68
+ $ this ->createContainerFromClosure (function ($ container ) {
69
+ $ container ->loadFromExtension ('framework ' , [
70
+ 'workflows ' => [
71
+ 'article ' => [
72
+ 'places ' => null ,
73
+ ],
74
+ ],
75
+ ]);
76
+ });
77
+ }
78
+
79
+ public function testWorkflowValidationTransitonsIsArray ()
80
+ {
81
+ $ this ->expectException (InvalidConfigurationException::class);
82
+ $ this ->expectExceptionMessage ('The "transitions" option must be an array in workflow configuration. ' );
83
+ $ this ->createContainerFromClosure (function ($ container ) {
84
+ $ container ->loadFromExtension ('framework ' , [
85
+ 'workflows ' => [
86
+ 'article ' => [
87
+ 'transitions ' => null ,
88
+ ],
89
+ ],
90
+ ]);
91
+ });
92
+ }
93
+
63
94
public function testWorkflowValidationStateMachine ()
64
95
{
65
96
$ this ->expectException (InvalidDefinitionException::class);
You can’t perform that action at this time.
0 commit comments