File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ public function __construct(array $config = [])
196
196
'prompt ' => '' ,
197
197
'openid.realm ' => '' ,
198
198
'include_granted_scopes ' => null ,
199
+ 'logger ' => null ,
199
200
'login_hint ' => '' ,
200
201
'request_visible_actions ' => '' ,
201
202
'access_type ' => 'online ' ,
@@ -242,6 +243,11 @@ public function __construct(array $config = [])
242
243
$ this ->setCache ($ this ->config ['cache ' ]);
243
244
unset($ this ->config ['cache ' ]);
244
245
}
246
+
247
+ if (!is_null ($ this ->config ['logger ' ])) {
248
+ $ this ->setLogger ($ this ->config ['logger ' ]);
249
+ unset($ this ->config ['logger ' ]);
250
+ }
245
251
}
246
252
247
253
/**
Original file line number Diff line number Diff line change @@ -268,6 +268,16 @@ public function testDefaultLoggerAppEngine()
268
268
$ this ->assertInstanceOf ('Monolog\Handler\SyslogHandler ' , $ handler );
269
269
}
270
270
271
+ public function testLoggerFromConstructor ()
272
+ {
273
+ $ logger1 = new \Monolog \Logger ('unit-test ' );
274
+ $ client = new Client (['logger ' => $ logger1 ]);
275
+ $ logger2 = $ client ->getLogger ();
276
+ $ this ->assertInstanceOf ('Monolog\Logger ' , $ logger2 );
277
+ $ this ->assertEquals ('unit-test ' , $ logger2 ->getName ());
278
+ $ this ->assertSame ($ logger1 , $ logger2 );
279
+ }
280
+
271
281
public function testSettersGetters ()
272
282
{
273
283
$ client = new Client ();
@@ -279,6 +289,7 @@ public function testSettersGetters()
279
289
280
290
$ client ->setRedirectUri ('localhost ' );
281
291
$ client ->setConfig ('application_name ' , 'me ' );
292
+ $ client ->setLogger (new \Monolog \Logger ('test ' ));
282
293
283
294
$ cache = $ this ->prophesize (CacheItemPoolInterface::class);
284
295
$ client ->setCache ($ cache ->reveal ());
You can’t perform that action at this time.
0 commit comments