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 158158 * - [level]: level name or int value, defaults to DEBUG
159159 * - [bubble]: bool, defaults to true
160160 * - [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
162162 *
163163 * - swift_mailer:
164164 * - from_email: optional if email_prototype is given
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Bundle \MonologBundle \Tests \DependencyInjection ;
1313
14+ use Monolog \Handler \SyslogUdpHandler ;
1415use Monolog \Logger ;
1516use PHPUnit \Framework \TestCase ;
1617use Symfony \Bundle \MonologBundle \DependencyInjection \Configuration ;
@@ -406,6 +407,48 @@ public function testWithRedisHandler()
406407 $ this ->assertEquals ('monolog_redis_test ' , $ config ['handlers ' ]['redis ' ]['redis ' ]['key_name ' ]);
407408 }
408409
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+
409452 /**
410453 * Processes an array of configurations and returns a compiled version.
411454 *
You can’t perform that action at this time.
0 commit comments