|
18 | 18 | use Monolog\Handler\RollbarHandler; |
19 | 19 | use Monolog\Processor\UidProcessor; |
20 | 20 | use PHPUnit\Framework\Attributes\DataProvider; |
21 | | -use PHPUnit\Framework\Attributes\Group; |
22 | | -use PHPUnit\Framework\Attributes\IgnoreDeprecations; |
23 | 21 | use Symfony\Bundle\MonologBundle\DependencyInjection\Compiler\LoggerChannelPass; |
24 | 22 | use Symfony\Bundle\MonologBundle\DependencyInjection\MonologExtension; |
25 | 23 | use Symfony\Bundle\MonologBundle\Tests\DependencyInjection\Fixtures\AsMonologProcessor\FooProcessorWithPriority; |
@@ -556,84 +554,6 @@ public function testElasticsearchAndElasticaHandlers() |
556 | 554 | $this->assertSame(['hosts' => ['es:9200'], 'transport' => 'Http'], $elasticaClient->getArgument(0)); |
557 | 555 | } |
558 | 556 |
|
559 | | - #[Group('legacy')] |
560 | | - #[IgnoreDeprecations] |
561 | | - public function testMongo() |
562 | | - { |
563 | | - if (!class_exists('MongoDB\Client')) { |
564 | | - $this->markTestSkipped('mongodb/mongodb is not installed.'); |
565 | | - } |
566 | | - |
567 | | - // $this->expectDeprecation('Since symfony/monolog-bundle 3.11: The "mongo" handler type is deprecated in MonologBundle since version 3.11.0, use the "mongodb" type instead.'); |
568 | | - |
569 | | - $container = new ContainerBuilder(); |
570 | | - $container->setDefinition('mongodb.client', new Definition('MongoDB\Client')); |
571 | | - |
572 | | - $config = [[ |
573 | | - 'handlers' => [ |
574 | | - 'mongo_with_id' => [ |
575 | | - 'type' => 'mongo', |
576 | | - 'mongo' => ['id' => 'mongodb.client'], |
577 | | - ], |
578 | | - 'mongo_with_string_id' => [ |
579 | | - 'type' => 'mongo', |
580 | | - 'mongo' => 'mongodb.client', |
581 | | - ], |
582 | | - 'mongo_with_host' => [ |
583 | | - 'type' => 'mongo', |
584 | | - 'mongo' => [ |
585 | | - 'host' => 'localhost', |
586 | | - 'port' => '27018', |
587 | | - 'user' => 'username', |
588 | | - 'pass' => 'password', |
589 | | - 'database' => 'db', |
590 | | - 'collection' => 'coll', |
591 | | - ], |
592 | | - ], |
593 | | - 'mongo_with_host_and_default_args' => [ |
594 | | - 'type' => 'mongo', |
595 | | - 'mongo' => [ |
596 | | - 'host' => 'localhost', |
597 | | - ], |
598 | | - ], |
599 | | - ], |
600 | | - ]]; |
601 | | - |
602 | | - $extension = new MonologExtension(); |
603 | | - $extension->load($config, $container); |
604 | | - |
605 | | - $this->assertTrue($container->hasDefinition('monolog.handler.mongo_with_id')); |
606 | | - $this->assertTrue($container->hasDefinition('monolog.handler.mongo_with_string_id')); |
607 | | - $this->assertTrue($container->hasDefinition('monolog.handler.mongo_with_host')); |
608 | | - $this->assertTrue($container->hasDefinition('monolog.handler.mongo_with_host_and_default_args')); |
609 | | - |
610 | | - // MongoDB handler should receive the mongodb.client as first argument |
611 | | - $handler = $container->getDefinition('monolog.handler.mongo_with_id'); |
612 | | - $this->assertDICDefinitionClass($handler, MongoDBHandler::class); |
613 | | - $this->assertDICConstructorArguments($handler, [new Reference('mongodb.client'), 'monolog', 'logs', 'DEBUG', true]); |
614 | | - |
615 | | - // MongoDB handler should receive the mongodb.client as first argument |
616 | | - $handler = $container->getDefinition('monolog.handler.mongo_with_string_id'); |
617 | | - $this->assertDICDefinitionClass($handler, MongoDBHandler::class); |
618 | | - $this->assertDICConstructorArguments($handler, [new Reference('mongodb.client'), 'monolog', 'logs', 'DEBUG', true]); |
619 | | - |
620 | | - // MongoDB handler with host and arguments |
621 | | - $handler = $container->getDefinition('monolog.handler.mongo_with_host'); |
622 | | - $this->assertDICDefinitionClass($handler, MongoDBHandler::class); |
623 | | - $client = $handler->getArgument(0); |
624 | | - $this->assertDICDefinitionClass($client, 'MongoDB\Client'); |
625 | | - $this->assertDICConstructorArguments($client, ['mongodb://username:password@localhost:27018', ['appname' => 'monolog-bundle']]); |
626 | | - $this->assertDICConstructorArguments($handler, [$client, 'db', 'coll', 'DEBUG', true]); |
627 | | - |
628 | | - // MongoDB handler with host and default arguments |
629 | | - $handler = $container->getDefinition('monolog.handler.mongo_with_host_and_default_args'); |
630 | | - $this->assertDICDefinitionClass($handler, MongoDBHandler::class); |
631 | | - $client = $handler->getArgument(0); |
632 | | - $this->assertDICDefinitionClass($client, 'MongoDB\Client'); |
633 | | - $this->assertDICConstructorArguments($client, ['mongodb://localhost:27017', ['appname' => 'monolog-bundle']]); |
634 | | - $this->assertDICConstructorArguments($handler, [$client, 'monolog', 'logs', 'DEBUG', true]); |
635 | | - } |
636 | | - |
637 | 557 | public function testMongoDB() |
638 | 558 | { |
639 | 559 | if (!class_exists('MongoDB\Client')) { |
|
0 commit comments