@@ -84,6 +84,31 @@ public function testLoadWithServiceHandler()
84
84
$ this ->assertTrue ($ container ->hasDefinition ('monolog.logger ' ));
85
85
$ this ->assertTrue ($ container ->hasAlias ('monolog.handler.custom ' ));
86
86
87
+ $ logger = $ container ->getDefinition ('monolog.logger ' );
88
+ // Custom service handler must be pushed to logger
89
+ $ this ->assertDICDefinitionMethodCallAt (0 , $ logger , 'useMicrosecondTimestamps ' , array ('%monolog.use_microseconds% ' ));
90
+ $ this ->assertDICDefinitionMethodCallAt (1 , $ logger , 'pushHandler ' , array (new Reference ('monolog.handler.custom ' )));
91
+
92
+ $ handler = $ container ->findDefinition ('monolog.handler.custom ' );
93
+ $ this ->assertDICDefinitionClass ($ handler , 'stdClass ' );
94
+ $ this ->assertDICConstructorArguments ($ handler , array ('foo ' , false ));
95
+ }
96
+
97
+ public function testLoadWithNestedServiceHandler ()
98
+ {
99
+ $ container = $ this ->getContainer (
100
+ array (array ('handlers ' => array ('custom ' => array ('type ' => 'service ' , 'id ' => 'some.service.id ' , 'nested ' => true )))),
101
+ array ('some.service.id ' => new Definition ('stdClass ' , array ('foo ' , false )))
102
+ );
103
+
104
+ $ this ->assertTrue ($ container ->hasDefinition ('monolog.logger ' ));
105
+ $ this ->assertTrue ($ container ->hasAlias ('monolog.handler.custom ' ));
106
+
107
+ $ logger = $ container ->getDefinition ('monolog.logger ' );
108
+ // Nested service handler must not be pushed to logger
109
+ $ this ->assertCount (1 , $ logger ->getMethodCalls ());
110
+ $ this ->assertDICDefinitionMethodCallAt (0 , $ logger , 'useMicrosecondTimestamps ' , array ('%monolog.use_microseconds% ' ));
111
+
87
112
$ handler = $ container ->findDefinition ('monolog.handler.custom ' );
88
113
$ this ->assertDICDefinitionClass ($ handler , 'stdClass ' );
89
114
$ this ->assertDICConstructorArguments ($ handler , array ('foo ' , false ));
0 commit comments