@@ -361,6 +361,7 @@ public function testWithNestedHandler()
361361
362362 $ this ->assertTrue ($ config ['handlers ' ]['foobar ' ]['nested ' ]);
363363 }
364+
364365 public function testWithRedisHandler ()
365366 {
366367 $ configs = [
@@ -406,6 +407,88 @@ public function testWithRedisHandler()
406407 $ this ->assertEquals ('monolog_redis_test ' , $ config ['handlers ' ]['redis ' ]['redis ' ]['key_name ' ]);
407408 }
408409
410+ /**
411+ * @group legacy
412+ */
413+ public function testConsoleFormatterOptionsRename ()
414+ {
415+ $ configs = [
416+ [
417+ 'handlers ' => [
418+ 'old ' => [
419+ 'type ' => 'console ' ,
420+ 'console_formater_options ' => ['foo ' => 'foo ' ],
421+ ],
422+ 'old2 ' => [
423+ 'type ' => 'console ' ,
424+ 'console_formater_options ' => ['foo ' => 'foo ' ],
425+ ],
426+ 'new ' => [
427+ 'type ' => 'console ' ,
428+ 'console_formatter_options ' => ['bar ' => 'bar ' ],
429+ ],
430+ 'new2 ' => [
431+ 'type ' => 'console ' ,
432+ 'console_formatter_options ' => ['bar ' => 'bar ' ],
433+ ],
434+ 'both ' => [
435+ 'type ' => 'console ' ,
436+ 'console_formater_options ' => ['foo ' => 'foo ' ],
437+ 'console_formatter_options ' => ['bar ' => 'bar ' ],
438+ ],
439+ 'both2 ' => [
440+ 'type ' => 'console ' ,
441+ 'console_formater_options ' => ['foo ' => 'foo ' ],
442+ 'console_formatter_options ' => ['bar ' => 'bar ' ],
443+ ],
444+ ],
445+ ],
446+ [
447+ 'handlers ' => [
448+ 'old2 ' => [
449+ 'type ' => 'console ' ,
450+ 'console_formater_options ' => ['baz ' => 'baz ' ],
451+ ],
452+ 'new2 ' => [
453+ 'type ' => 'console ' ,
454+ 'console_formatter_options ' => ['qux ' => 'qux ' ],
455+ ],
456+ 'both2 ' => [
457+ 'type ' => 'console ' ,
458+ 'console_formater_options ' => ['baz ' => 'baz ' ],
459+ 'console_formatter_options ' => ['qux ' => 'qux ' ],
460+ ],
461+ ],
462+ ],
463+ ];
464+
465+ $ config = $ this ->process ($ configs );
466+
467+ $ this ->assertArrayHasKey ('console_formatter_options ' , $ config ['handlers ' ]['old ' ]);
468+ $ this ->assertSame (['foo ' => 'foo ' ], $ config ['handlers ' ]['old ' ]['console_formatter_options ' ]);
469+ $ this ->assertArrayNotHasKey ('console_formater_options ' , $ config ['handlers ' ]['old ' ]);
470+
471+ $ this ->assertArrayHasKey ('console_formatter_options ' , $ config ['handlers ' ]['new ' ]);
472+ $ this ->assertSame (['bar ' => 'bar ' ], $ config ['handlers ' ]['new ' ]['console_formatter_options ' ]);
473+ $ this ->assertArrayNotHasKey ('console_formater_options ' , $ config ['handlers ' ]['new ' ]);
474+
475+ $ this ->assertArrayHasKey ('console_formatter_options ' , $ config ['handlers ' ]['both ' ]);
476+ $ this ->assertSame (['bar ' => 'bar ' ], $ config ['handlers ' ]['both ' ]['console_formatter_options ' ]);
477+ $ this ->assertArrayNotHasKey ('console_formater_options ' , $ config ['handlers ' ]['both ' ]);
478+
479+ $ this ->assertArrayHasKey ('console_formatter_options ' , $ config ['handlers ' ]['old2 ' ]);
480+ $ this ->assertSame (['baz ' => 'baz ' ], $ config ['handlers ' ]['old2 ' ]['console_formatter_options ' ]);
481+ $ this ->assertArrayNotHasKey ('console_formater_options ' , $ config ['handlers ' ]['old2 ' ]);
482+
483+ $ this ->assertArrayHasKey ('console_formatter_options ' , $ config ['handlers ' ]['new2 ' ]);
484+ $ this ->assertSame (['qux ' => 'qux ' ], $ config ['handlers ' ]['new2 ' ]['console_formatter_options ' ]);
485+ $ this ->assertArrayNotHasKey ('console_formater_options ' , $ config ['handlers ' ]['new2 ' ]);
486+
487+ $ this ->assertArrayHasKey ('console_formatter_options ' , $ config ['handlers ' ]['both2 ' ]);
488+ $ this ->assertSame (['qux ' => 'qux ' ], $ config ['handlers ' ]['both2 ' ]['console_formatter_options ' ]);
489+ $ this ->assertArrayNotHasKey ('console_formater_options ' , $ config ['handlers ' ]['both2 ' ]);
490+ }
491+
409492 /**
410493 * Processes an array of configurations and returns a compiled version.
411494 *
0 commit comments