File tree 2 files changed +39
-0
lines changed
src/Symfony/Bundle/FrameworkBundle
Tests/DependencyInjection
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
446
446
->beforeNormalization ()
447
447
->always ()
448
448
->then (function ($ places ) {
449
+ if (!\is_array ($ places )) {
450
+ throw new InvalidConfigurationException ('The "places" option must be an array in workflow configuration. ' );
451
+ }
452
+
449
453
// It's an indexed array of shape ['place1', 'place2']
450
454
if (isset ($ places [0 ]) && \is_string ($ places [0 ])) {
451
455
return array_map (function (string $ place ) {
@@ -491,6 +495,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
491
495
->beforeNormalization ()
492
496
->always ()
493
497
->then (function ($ transitions ) {
498
+ if (!\is_array ($ transitions )) {
499
+ throw new InvalidConfigurationException ('The "transitions" option must be an array in workflow configuration. ' );
500
+ }
501
+
494
502
// It's an indexed array, we let the validation occur
495
503
if (isset ($ transitions [0 ]) && \is_array ($ transitions [0 ])) {
496
504
return $ transitions ;
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 ;
@@ -56,6 +57,36 @@ public function testAssetPackageCannotHavePathAndUrl()
56
57
});
57
58
}
58
59
60
+ public function testWorkflowValidationPlacesIsArray ()
61
+ {
62
+ $ this ->expectException (InvalidConfigurationException::class);
63
+ $ this ->expectExceptionMessage ('The "places" option must be an array in workflow configuration. ' );
64
+ $ this ->createContainerFromClosure (function ($ container ) {
65
+ $ container ->loadFromExtension ('framework ' , [
66
+ 'workflows ' => [
67
+ 'article ' => [
68
+ 'places ' => null ,
69
+ ],
70
+ ],
71
+ ]);
72
+ });
73
+ }
74
+
75
+ public function testWorkflowValidationTransitonsIsArray ()
76
+ {
77
+ $ this ->expectException (InvalidConfigurationException::class);
78
+ $ this ->expectExceptionMessage ('The "transitions" option must be an array in workflow configuration. ' );
79
+ $ this ->createContainerFromClosure (function ($ container ) {
80
+ $ container ->loadFromExtension ('framework ' , [
81
+ 'workflows ' => [
82
+ 'article ' => [
83
+ 'transitions ' => null ,
84
+ ],
85
+ ],
86
+ ]);
87
+ });
88
+ }
89
+
59
90
public function testWorkflowValidationStateMachine ()
60
91
{
61
92
$ this ->expectException (InvalidDefinitionException::class);
You can’t perform that action at this time.
0 commit comments