diff --git a/APM/PSRCommandLogger.php b/APM/PSRCommandLogger.php index 859080d4..8fe049c8 100644 --- a/APM/PSRCommandLogger.php +++ b/APM/PSRCommandLogger.php @@ -4,16 +4,16 @@ namespace Doctrine\Bundle\MongoDBBundle\APM; +use Doctrine\ODM\MongoDB\APM\CommandLoggerInterface; use MongoDB\Driver\Monitoring\CommandFailedEvent; use MongoDB\Driver\Monitoring\CommandStartedEvent; -use MongoDB\Driver\Monitoring\CommandSubscriber; use MongoDB\Driver\Monitoring\CommandSucceededEvent; use Psr\Log\LoggerInterface; use function json_encode; use function MongoDB\Driver\Monitoring\addSubscriber; use function MongoDB\Driver\Monitoring\removeSubscriber; -final class PSRCommandLogger implements CommandSubscriber +final class PSRCommandLogger implements CommandLoggerInterface { /** @var bool */ private $registered = false; diff --git a/CHANGELOG-4.0.md b/CHANGELOG-4.0.md index 17f5e0e8..9d16014b 100644 --- a/CHANGELOG-4.0.md +++ b/CHANGELOG-4.0.md @@ -1,6 +1,13 @@ CHANGELOG for 4.0.x =================== +4.0.0-RC3 (2019-09-30) +---------------------- + +All issues and pull requests in this release may be found under the [4.0.0-RC3 milestone](https://github.com/doctrine/DoctrineMongoDBBundle/issues?q=milestone%3A4.0.0-RC3). + + - [585: Fix wrong interface inheritance in command logger](https://github.com/doctrine/DoctrineMongoDBBundle/pull/585) thanks to @alcaeus and @lljaworski + 4.0.0-RC2 (2019-09-24) ---------------------- diff --git a/Tests/ContainerTest.php b/Tests/ContainerTest.php index 6bfc6d1e..a4ac1660 100644 --- a/Tests/ContainerTest.php +++ b/Tests/ContainerTest.php @@ -47,6 +47,11 @@ public function testLoggerConfig(bool $expected, array $config, bool $debug) $definition = $this->container->getDefinition('doctrine_mongodb.odm.command_logger'); $this->assertSame($expected, $definition->hasTag('doctrine_mongodb.odm.command_logger')); + + $this->container->compile(); + + // Fetch the command logger registry to make sure the appropriate number of services has been registered + $this->container->get('doctrine_mongodb.odm.command_logger_registry'); } public function provideLoggerConfigs() @@ -54,29 +59,29 @@ public function provideLoggerConfigs() $config = ['connections' => ['default' => []]]; return [ - [ + 'Debug mode enabled' => [ // Logging is always enabled in debug mode - true, - [ + 'expected' => true, + 'config' => [ 'document_managers' => ['default' => []], ] + $config, - true, + 'debug' => true, ], - [ + 'Debug mode disabled' => [ // Logging is disabled by default when not in debug mode - false, - [ + 'expected' => false, + 'config' => [ 'document_managers' => ['default' => []], ] + $config, - false, + 'debug' => false, ], - [ + 'Logging enabled by config' => [ // Logging can be enabled by config - true, - [ + 'expected' => true, + 'config' => [ 'document_managers' => ['default' => ['logging' => true]], ] + $config, - false, + 'debug' => false, ], ]; } @@ -94,6 +99,11 @@ public function testDataCollectorConfig(bool $expected, array $config, bool $deb $dataCollectorDefinition = $this->container->getDefinition('doctrine_mongodb.odm.data_collector'); $this->assertSame($expected, $dataCollectorDefinition->hasTag('data_collector')); + + $this->container->compile(); + + // Fetch the command logger registry to make sure the appropriate number of services has been registered + $this->container->get('doctrine_mongodb.odm.command_logger_registry'); } public function provideDataCollectorConfigs() @@ -101,29 +111,29 @@ public function provideDataCollectorConfigs() $config = ['connections' => ['default' => []]]; return [ - [ + 'Debug mode enabled' => [ // Profiling is always enabled in debug mode - true, - [ + 'expected' => true, + 'config' => [ 'document_managers' => ['default' => []], ] + $config, - true, + 'debug' => true, ], - [ + 'Debug mode disabled' => [ // Profiling is disabled by default when not in debug mode - false, - [ + 'expected' => false, + 'config' => [ 'document_managers' => ['default' => []], ] + $config, - false, + 'debug' => false, ], - [ + 'Profiling enabled by config' => [ // Profiling can be enabled by config - true, - [ + 'expected' => true, + 'config' => [ 'document_managers' => ['default' => ['profiler' => true]], ] + $config, - false, + 'debug' => false, ], ]; } diff --git a/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php b/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php index 86c03fd3..51e8c2e6 100644 --- a/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php +++ b/Tests/DependencyInjection/AbstractMongoDBExtensionTest.php @@ -158,9 +158,9 @@ public function testLoadSimpleSingleConnection() $this->assertArrayHasKey('typeMap', $arguments[2]); $this->assertSame(['root' => 'array', 'document' => 'array'], $arguments[2]['typeMap']); - $definition = $container->getDefinition('doctrine_mongodb.odm.default_configuration'); - $methodCalls = $definition->getMethodCalls(); - $methodNames = array_map(static function ($call) { + $definition = $container->getDefinition('doctrine_mongodb.odm.default_configuration'); + $methodCalls = $definition->getMethodCalls(); + $methodNames = array_map(static function ($call) { return $call[0]; }, $methodCalls); $this->assertInternalType('integer', $pos = array_search('setDefaultDB', $methodNames)); diff --git a/Tests/DependencyInjection/DoctrineMongoDBExtensionTest.php b/Tests/DependencyInjection/DoctrineMongoDBExtensionTest.php index fe21baf6..18d1909c 100644 --- a/Tests/DependencyInjection/DoctrineMongoDBExtensionTest.php +++ b/Tests/DependencyInjection/DoctrineMongoDBExtensionTest.php @@ -222,7 +222,7 @@ public function testFactoriesAreRegistered() public function testPublicServicesAndAliases() { - $loader = new DoctrineMongoDBExtension(); + $loader = new DoctrineMongoDBExtension(); $loader->load(self::buildConfiguration(), $container = $this->buildMinimalContainer()); $this->assertTrue($container->getDefinition('doctrine_mongodb')->isPublic()); diff --git a/composer.json b/composer.json index 3f796406..313b104f 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "php": "^7.2", "doctrine/annotations": "^1.2", - "doctrine/mongodb-odm": "^2.0.0-RC1", + "doctrine/mongodb-odm": "^2.0.0-RC2", "psr/log": "^1.0", "symfony/console": "^3.4 || ^4.0", "symfony/dependency-injection": "^3.4 || ^4.0", @@ -26,6 +26,7 @@ "doctrine/coding-standard": "^6.0", "doctrine/data-fixtures": "^1.2.2", "phpunit/phpunit": "^7.3", + "squizlabs/php_codesniffer": "^3.5", "symfony/form": "^3.4 || ^4.0", "symfony/phpunit-bridge": "^3.4 || ^4.0", "symfony/yaml": "^3.4 || ^4.0"