File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
454
454
->beforeNormalization ()
455
455
->always ()
456
456
->then (function ($ places ) {
457
+ if (!\is_array ($ places )) {
458
+ throw new InvalidConfigurationException ('The "places" option must be an array in workflow configuration. ' );
459
+ }
460
+
457
461
// It's an indexed array of shape ['place1', 'place2']
458
462
if (isset ($ places [0 ]) && \is_string ($ places [0 ])) {
459
463
return array_map (function (string $ place ) {
@@ -499,6 +503,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
499
503
->beforeNormalization ()
500
504
->always ()
501
505
->then (function ($ transitions ) {
506
+ if (!\is_array ($ transitions )) {
507
+ throw new InvalidConfigurationException ('The "transitions" option must be an array in workflow configuration. ' );
508
+ }
509
+
502
510
// It's an indexed array, we let the validation occur
503
511
if (isset ($ transitions [0 ]) && \is_array ($ transitions [0 ])) {
504
512
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 ;
@@ -58,6 +59,36 @@ public function testAssetPackageCannotHavePathAndUrl()
58
59
});
59
60
}
60
61
62
+ public function testWorkflowValidationPlacesIsArray ()
63
+ {
64
+ $ this ->expectException (InvalidConfigurationException::class);
65
+ $ this ->expectExceptionMessage ('The "places" option must be an array in workflow configuration. ' );
66
+ $ this ->createContainerFromClosure (function ($ container ) {
67
+ $ container ->loadFromExtension ('framework ' , [
68
+ 'workflows ' => [
69
+ 'article ' => [
70
+ 'places ' => null ,
71
+ ],
72
+ ],
73
+ ]);
74
+ });
75
+ }
76
+
77
+ public function testWorkflowValidationTransitonsIsArray ()
78
+ {
79
+ $ this ->expectException (InvalidConfigurationException::class);
80
+ $ this ->expectExceptionMessage ('The "transitions" option must be an array in workflow configuration. ' );
81
+ $ this ->createContainerFromClosure (function ($ container ) {
82
+ $ container ->loadFromExtension ('framework ' , [
83
+ 'workflows ' => [
84
+ 'article ' => [
85
+ 'transitions ' => null ,
86
+ ],
87
+ ],
88
+ ]);
89
+ });
90
+ }
91
+
61
92
public function testWorkflowValidationStateMachine ()
62
93
{
63
94
$ this ->expectException (InvalidDefinitionException::class);
You can’t perform that action at this time.
0 commit comments