Skip to content

Commit

Permalink
[Lock] Fix mongodb extension requirement in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN authored and fabpot committed Oct 28, 2023
1 parent 2213955 commit 671769f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use MongoDB\Client;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\SkippedTestSuiteError;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler;

Expand All @@ -32,13 +33,16 @@ class MongoDbSessionHandlerTest extends TestCase
private $storage;
public $options;

protected function setUp(): void
public static function setUpBeforeClass(): void
{
parent::setUp();

if (!class_exists(Client::class)) {
$this->markTestSkipped('The mongodb/mongodb package is required.');
throw new SkippedTestSuiteError('The mongodb/mongodb package is required.');
}
}

protected function setUp(): void
{
parent::setUp();

$this->mongo = $this->getMockBuilder(Client::class)
->disableOriginalConstructor()
Expand Down

0 comments on commit 671769f

Please sign in to comment.