Skip to content

Commit 889a680

Browse files
committed
Skip tests if mongodb/mongodb is not installed
1 parent 1df9484 commit 889a680

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/DependencyInjection/FixtureMonologExtensionTestCase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ public function testEnabledHandleOption()
335335

336336
public function testMongoDB()
337337
{
338+
if (!class_exists('MongoDB\Client')) {
339+
$this->markTestSkipped('mongodb/mongodb is not installed.');
340+
}
341+
338342
$container = $this->getContainer('mongodb');
339343

340344
$this->assertTrue($container->hasDefinition('monolog.handler.mongodb'));

tests/DependencyInjection/MonologExtensionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,10 @@ public function testElasticsearchAndElasticaHandlers()
936936
/** @group legacy */
937937
public function testMongo()
938938
{
939+
if (!class_exists('MongoDB\Client')) {
940+
$this->markTestSkipped('mongodb/mongodb is not installed.');
941+
}
942+
939943
$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.');
940944

941945
$container = new ContainerBuilder();
@@ -1008,6 +1012,10 @@ public function testMongo()
10081012

10091013
public function testMongoDB()
10101014
{
1015+
if (!class_exists('MongoDB\Client')) {
1016+
$this->markTestSkipped('mongodb/mongodb is not installed.');
1017+
}
1018+
10111019
$container = new ContainerBuilder();
10121020
$container->setDefinition('mongodb.client', new Definition('MongoDB\Client'));
10131021

0 commit comments

Comments
 (0)