Skip to content

Commit

Permalink
Skip mongodb extension if extension is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Aug 2, 2023
1 parent e239236 commit f800f77
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tests/Monolog/Handler/MongoDBHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use MongoDB\Driver\Manager;
use Monolog\Test\TestCase;

/**
* @requires extension mongodb
*/
class MongoDBHandlerTest extends TestCase
{
public function testConstructorShouldThrowExceptionForInvalidMongo()
Expand All @@ -25,10 +28,6 @@ public function testConstructorShouldThrowExceptionForInvalidMongo()

public function testHandleWithLibraryClient()
{
if (!(class_exists('MongoDB\Client'))) {
$this->markTestSkipped('mongodb/mongodb not installed');
}

$mongodb = $this->getMockBuilder('MongoDB\Client')
->disableOriginalConstructor()
->getMock();
Expand Down Expand Up @@ -56,10 +55,6 @@ public function testHandleWithLibraryClient()

public function testHandleWithDriverManager()
{
if (!(class_exists('MongoDB\Driver\Manager'))) {
$this->markTestSkipped('ext-mongodb not installed');
}

/* This can become a unit test once ManagerInterface can be mocked.
* See: https://jira.mongodb.org/browse/PHPC-378
*/
Expand Down

0 comments on commit f800f77

Please sign in to comment.