@@ -61,6 +61,25 @@ public function testShouldAllowAddConfiguration()
6161 ], $ config );
6262 }
6363
64+ public function testShouldAllowAddConfigurationAsString ()
65+ {
66+ $ transport = new DbalTransportFactory ();
67+ $ tb = new TreeBuilder ();
68+ $ rootNode = $ tb ->root ('foo ' );
69+
70+ $ transport ->addConfiguration ($ rootNode );
71+ $ processor = new Processor ();
72+ $ config = $ processor ->process ($ tb ->buildTree (), ['mysqlDSN ' ]);
73+
74+ $ this ->assertEquals ([
75+ 'dsn ' => 'mysqlDSN ' ,
76+ 'dbal_connection_name ' => null ,
77+ 'table_name ' => 'enqueue ' ,
78+ 'polling_interval ' => 1000 ,
79+ 'lazy ' => true ,
80+ ], $ config );
81+ }
82+
6483 public function testShouldCreateDbalConnectionFactory ()
6584 {
6685 $ container = new ContainerBuilder ();
@@ -89,6 +108,26 @@ public function testShouldCreateDbalConnectionFactory()
89108 ], $ factory ->getArgument (0 ));
90109 }
91110
111+ public function testShouldCreateConnectionFactoryFromDsnString ()
112+ {
113+ $ container = new ContainerBuilder ();
114+
115+ $ transport = new DbalTransportFactory ();
116+
117+ $ serviceId = $ transport ->createConnectionFactory ($ container , [
118+ 'dsn ' => 'theDSN ' ,
119+ 'connection ' => [],
120+ 'lazy ' => true ,
121+ 'table_name ' => 'enqueue ' ,
122+ 'polling_interval ' => 1000 ,
123+ ]);
124+
125+ $ this ->assertTrue ($ container ->hasDefinition ($ serviceId ));
126+ $ factory = $ container ->getDefinition ($ serviceId );
127+ $ this ->assertEquals (DbalConnectionFactory::class, $ factory ->getClass ());
128+ $ this ->assertSame ('theDSN ' , $ factory ->getArgument (0 ));
129+ }
130+
92131 public function testShouldCreateManagerRegistryConnectionFactory ()
93132 {
94133 $ container = new ContainerBuilder ();
0 commit comments