File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,9 @@ private function addConnectionsSection(ArrayNodeDefinition $rootNode)
232232 ->prototype ('scalar ' )->end ()
233233 ->end ()
234234 ->end ()
235- ->scalarNode ('replicaSet ' )->end ()
235+ ->scalarNode ('replicaSet ' )
236+ ->validate ()->ifTrue (function ($ v ) { return !is_string ($ v ); })->thenInvalid ('The replicaSet option must be a string ' )->end ()
237+ ->end ()
236238 ->scalarNode ('socketTimeoutMS ' )->end ()
237239 ->booleanNode ('ssl ' )->end ()
238240 ->scalarNode ('username ' )
Original file line number Diff line number Diff line change @@ -412,4 +412,26 @@ public function testPasswordAndUsernameShouldBeUnsetIfNull()
412412 $ this ->assertEquals (array ('username ' => 'foo ' ), $ options ['connections ' ]['conn2 ' ]['options ' ]);
413413 $ this ->assertEquals (array (), $ options ['connections ' ]['conn3 ' ]['options ' ]);
414414 }
415+
416+ /**
417+ * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
418+ * @expectedExceptionMessage The replicaSet option must be a string
419+ */
420+ public function testInvalidReplicaSetValue ()
421+ {
422+ $ config = array (
423+ 'connections ' => array (
424+ 'conn1 ' => array (
425+ 'server ' => 'mongodb://localhost ' ,
426+ 'options ' => array (
427+ 'replicaSet ' => true
428+ )
429+ )
430+ )
431+ );
432+
433+ $ processor = new Processor ();
434+ $ configuration = new Configuration (false );
435+ $ processor ->processConfiguration ($ configuration , array ($ config ));
436+ }
415437}
You can’t perform that action at this time.
0 commit comments