@@ -210,16 +210,19 @@ public function testSocketHandler()
210210
211211 }
212212
213- public function testRavenHandler ()
213+ public function testRavenHandlerWhenConfigurationIsWrong ()
214214 {
215- $ dsn =
'http://43f6017361224d098402974103bfc53d:[email protected] :9000/1 ' ;
216-
217215 try {
218216 $ this ->getContainer (array (array ('handlers ' => array ('raven ' => array ('type ' => 'raven ' )))));
219217 $ this ->fail ();
220218 } catch (InvalidConfigurationException $ e ) {
221219 $ this ->assertContains ('DSN ' , $ e ->getMessage ());
222220 }
221+ }
222+
223+ public function testRavenHandlerWhenADSNIsSpecified ()
224+ {
225+ $ dsn =
'http://43f6017361224d098402974103bfc53d:[email protected] :9000/1 ' ;
223226
224227 $ container = $ this ->getContainer (array (array ('handlers ' => array ('raven ' => array (
225228 'type ' => 'raven ' , 'dsn ' => $ dsn )
@@ -234,15 +237,36 @@ public function testRavenHandler()
234237
235238 $ handler = $ container ->getDefinition ('monolog.handler.raven ' );
236239 $ this ->assertDICDefinitionClass ($ handler , '%monolog.handler.raven.class% ' );
240+ }
237241
242+ public function testRavenHandlerWhenADSNAndAClientAreSpecified ()
243+ {
238244 $ container = $ this ->getContainer (array (array ('handlers ' => array ('raven ' => array (
239- 'type ' => 'raven ' , 'dsn ' => $ dsn , 'client_id ' => 'raven.client ' )
245+ 'type ' => 'raven ' , 'dsn ' => ' foobar ' , 'client_id ' => 'raven.client ' )
240246 ))));
241247
242- $ this ->assertTrue ($ container ->hasDefinition ('raven.client ' ));
248+ $ this ->assertFalse ($ container ->hasDefinition ('raven.client ' ));
249+
250+ $ logger = $ container ->getDefinition ('monolog.logger ' );
251+ $ this ->assertDICDefinitionMethodCallAt (0 , $ logger , 'pushHandler ' , array (new Reference ('monolog.handler.raven ' )));
243252
244- $ handler = $ container ->getDefinition ('raven.client ' );
245- $ this ->assertDICDefinitionClass ($ handler , 'Raven_Client ' );
253+ $ handler = $ container ->getDefinition ('monolog.handler.raven ' );
254+ $ this ->assertDICConstructorArguments ($ handler , array (new Reference ('raven.client ' ), 100 , true ));
255+ }
256+
257+ public function testRavenHandlerWhenAClientIsSpecified ()
258+ {
259+ $ container = $ this ->getContainer (array (array ('handlers ' => array ('raven ' => array (
260+ 'type ' => 'raven ' , 'client_id ' => 'raven.client ' )
261+ ))));
262+
263+ $ this ->assertFalse ($ container ->hasDefinition ('raven.client ' ));
264+
265+ $ logger = $ container ->getDefinition ('monolog.logger ' );
266+ $ this ->assertDICDefinitionMethodCallAt (0 , $ logger , 'pushHandler ' , array (new Reference ('monolog.handler.raven ' )));
267+
268+ $ handler = $ container ->getDefinition ('monolog.handler.raven ' );
269+ $ this ->assertDICConstructorArguments ($ handler , array (new Reference ('raven.client ' ), 100 , true ));
246270 }
247271
248272 public function testLogglyHandler ()
0 commit comments