2121use Symfony \Bundle \MonologBundle \DependencyInjection \MonologExtension ;
2222use Symfony \Bundle \MonologBundle \DependencyInjection \Compiler \LoggerChannelPass ;
2323use Symfony \Bundle \MonologBundle \Tests \DependencyInjection \Fixtures \AsMonologProcessor \FooProcessor ;
24+ use Symfony \Bundle \MonologBundle \Tests \DependencyInjection \Fixtures \AsMonologProcessor \FooProcessorWithPriority ;
2425use Symfony \Bundle \MonologBundle \Tests \DependencyInjection \Fixtures \AsMonologProcessor \RedeclareMethodProcessor ;
2526use Symfony \Component \DependencyInjection \ContainerBuilder ;
2627use Symfony \Component \DependencyInjection \Definition ;
@@ -826,8 +827,8 @@ public function testAsMonologProcessorAutoconfigurationRedeclareMethod(): void
826827 */
827828 public function testAsMonologProcessorAutoconfiguration (): void
828829 {
829- if (!\class_exists (AsMonologProcessor::class, true )) {
830- $ this ->markTestSkipped ('Monolog >= 2.3.6 is needed. ' );
830+ if (!\class_exists (AsMonologProcessor::class, true ) || \property_exists (AsMonologProcessor::class, ' priority ' ) ) {
831+ $ this ->markTestSkipped ('Monolog >= 2.3.6 and < 3.4.0 is needed. ' );
831832 }
832833
833834 $ container = $ this ->getContainer ([], [
@@ -848,6 +849,35 @@ public function testAsMonologProcessorAutoconfiguration(): void
848849 ], $ container ->getDefinition (FooProcessor::class)->getTag ('monolog.processor ' ));
849850 }
850851
852+ /**
853+ * @requires PHP 8.0
854+ */
855+ public function testAsMonologProcessorAutoconfigurationWithPriority (): void
856+ {
857+ if (!\class_exists (AsMonologProcessor::class, true ) || !\property_exists (AsMonologProcessor::class, 'priority ' )) {
858+ $ this ->markTestSkipped ('Monolog >= 3.4.0 is needed. ' );
859+ }
860+
861+ $ container = $ this ->getContainer ([], [
862+ FooProcessorWithPriority::class => (new Definition (FooProcessorWithPriority::class))->setAutoconfigured (true ),
863+ ]);
864+
865+ $ this ->assertSame ([
866+ [
867+ 'channel ' => null ,
868+ 'handler ' => 'foo_handler ' ,
869+ 'method ' => null ,
870+ 'priority ' => null ,
871+ ],
872+ [
873+ 'channel ' => 'ccc_channel ' ,
874+ 'handler ' => null ,
875+ 'method ' => '__invoke ' ,
876+ 'priority ' => 10 ,
877+ ],
878+ ], $ container ->getDefinition (FooProcessorWithPriority::class)->getTag ('monolog.processor ' ));
879+ }
880+
851881 protected function getContainer (array $ config = [], array $ thirdPartyDefinitions = [])
852882 {
853883 $ container = new ContainerBuilder (new EnvPlaceholderParameterBag ());
0 commit comments