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 163163 * - [level]: level name or int value, defaults to DEBUG
164164 * - [bubble]: bool, defaults to true
165165 * - [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
167167 *
168168 * - swift_mailer:
169169 * - 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 ;
@@ -407,6 +408,48 @@ public function testWithRedisHandler()
407408 $ this ->assertEquals ('monolog_redis_test ' , $ config ['handlers ' ]['redis ' ]['redis ' ]['key_name ' ]);
408409 }
409410
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+
410453 /**
411454 * @group legacy
412455 */
You can’t perform that action at this time.
0 commit comments