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 158
158
* - [level]: level name or int value, defaults to DEBUG
159
159
* - [bubble]: bool, defaults to true
160
160
* - [ident]: string, defaults to
161
- * - [rfc]: RFC3164 or RFC5424, defaults to RFC5424
161
+ * - [rfc]: SyslogUdpHandler:: RFC3164 (0) or SyslogUdpHandler:: RFC5424 (1) , defaults to SyslogUdpHandler:: RFC5424
162
162
*
163
163
* - swift_mailer:
164
164
* - 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 ;
@@ -406,6 +407,48 @@ public function testWithRedisHandler()
406
407
$ this ->assertEquals ('monolog_redis_test ' , $ config ['handlers ' ]['redis ' ]['redis ' ]['key_name ' ]);
407
408
}
408
409
410
+ public function testWithSyslogUdpHandler ()
411
+ {
412
+ $ configs = [
413
+ [
414
+ 'handlers ' => [
415
+ 'syslogudp ' => [
416
+ 'type ' => 'syslogudp ' ,
417
+ 'host ' => '127.0.0.1 ' ,
418
+ 'port ' => 514 ,
419
+ 'facility ' => 'USER ' ,
420
+ 'level ' => 'ERROR ' ,
421
+ 'rfc ' => SyslogUdpHandler::RFC3164
422
+ ]
423
+ ]
424
+ ]
425
+ ];
426
+ $ config = $ this ->process ($ configs );
427
+
428
+ $ this ->assertEquals ('syslogudp ' , $ config ['handlers ' ]['syslogudp ' ]['type ' ]);
429
+ $ this ->assertEquals ('127.0.0.1 ' , $ config ['handlers ' ]['syslogudp ' ]['host ' ]);
430
+ $ this ->assertEquals (514 , $ config ['handlers ' ]['syslogudp ' ]['port ' ]);
431
+ $ this ->assertEquals (0 , $ config ['handlers ' ]['syslogudp ' ]['rfc ' ]);
432
+
433
+ $ configs = [
434
+ [
435
+ 'handlers ' => [
436
+ 'syslogudp ' => [
437
+ 'type ' => 'syslogudp ' ,
438
+ 'host ' => '127.0.0.1 ' ,
439
+ 'port ' => 514 ,
440
+ 'facility ' => 'USER ' ,
441
+ 'level ' => 'ERROR ' ,
442
+ 'rfc ' => SyslogUdpHandler::RFC5424e
443
+ ]
444
+ ]
445
+ ]
446
+ ];
447
+
448
+ $ this ->expectException (InvalidConfigurationException::class);
449
+ $ config = $ this ->process ($ configs );
450
+ }
451
+
409
452
/**
410
453
* Processes an array of configurations and returns a compiled version.
411
454
*
You can’t perform that action at this time.
0 commit comments