File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
Tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 163
163
* - [level]: level name or int value, defaults to DEBUG
164
164
* - [bubble]: bool, defaults to true
165
165
* - [ident]: string, defaults to
166
- * - [rfc]: RFC3164 or RFC5424, defaults to RFC5424
166
+ * - [rfc]: SyslogUdpHandler:: RFC3164 (0) or SyslogUdpHandler:: RFC5424 (1) , defaults to SyslogUdpHandler:: RFC5424
167
167
*
168
168
* - swift_mailer:
169
169
* - from_email: optional if email_prototype is given
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Bundle \MonologBundle \Tests \DependencyInjection ;
13
13
14
+ use Monolog \Handler \SyslogUdpHandler ;
14
15
use Monolog \Logger ;
15
16
use PHPUnit \Framework \TestCase ;
16
17
use Symfony \Bundle \MonologBundle \DependencyInjection \Configuration ;
@@ -407,6 +408,48 @@ public function testWithRedisHandler()
407
408
$ this ->assertEquals ('monolog_redis_test ' , $ config ['handlers ' ]['redis ' ]['redis ' ]['key_name ' ]);
408
409
}
409
410
411
+ public function testWithSyslogUdpHandler ()
412
+ {
413
+ $ configs = [
414
+ [
415
+ 'handlers ' => [
416
+ 'syslogudp ' => [
417
+ 'type ' => 'syslogudp ' ,
418
+ 'host ' => '127.0.0.1 ' ,
419
+ 'port ' => 514 ,
420
+ 'facility ' => 'USER ' ,
421
+ 'level ' => 'ERROR ' ,
422
+ 'rfc ' => SyslogUdpHandler::RFC3164
423
+ ]
424
+ ]
425
+ ]
426
+ ];
427
+ $ config = $ this ->process ($ configs );
428
+
429
+ $ this ->assertEquals ('syslogudp ' , $ config ['handlers ' ]['syslogudp ' ]['type ' ]);
430
+ $ this ->assertEquals ('127.0.0.1 ' , $ config ['handlers ' ]['syslogudp ' ]['host ' ]);
431
+ $ this ->assertEquals (514 , $ config ['handlers ' ]['syslogudp ' ]['port ' ]);
432
+ $ this ->assertEquals (0 , $ config ['handlers ' ]['syslogudp ' ]['rfc ' ]);
433
+
434
+ $ configs = [
435
+ [
436
+ 'handlers ' => [
437
+ 'syslogudp ' => [
438
+ 'type ' => 'syslogudp ' ,
439
+ 'host ' => '127.0.0.1 ' ,
440
+ 'port ' => 514 ,
441
+ 'facility ' => 'USER ' ,
442
+ 'level ' => 'ERROR ' ,
443
+ 'rfc ' => SyslogUdpHandler::RFC5424e
444
+ ]
445
+ ]
446
+ ]
447
+ ];
448
+
449
+ $ this ->expectException (InvalidConfigurationException::class);
450
+ $ config = $ this ->process ($ configs );
451
+ }
452
+
410
453
/**
411
454
* @group legacy
412
455
*/
You can’t perform that action at this time.
0 commit comments