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 f411119 commit 759554c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions Tests/Store/MongoDbStoreFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@

namespace Symfony\Component\Lock\Tests\Store;

use MongoDB\Collection;
use MongoDB\Client;
use PHPUnit\Framework\SkippedTestSuiteError;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Lock\Store\MongoDbStore;
use Symfony\Component\Lock\Store\StoreFactory;

/**
* @author Alexandre Daubois <alex.daubois@gmail.com>
*
* @requires extension mongo
* @requires extension mongodb
*/
class MongoDbStoreFactoryTest extends TestCase
{
public static function setupBeforeClass(): void
{
if (!class_exists(Client::class)) {
throw new SkippedTestSuiteError('The mongodb/mongodb package is required.');
}
}

public function testCreateMongoDbCollectionStore()
{
$store = StoreFactory::createStore($this->createMock(\MongoDB\Collection::class));
$store = StoreFactory::createStore($this->createMock(Collection::class));

$this->assertInstanceOf(MongoDbStore::class, $store);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Store/MongoDbStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MongoDbStoreTest extends AbstractStoreTestCase

public static function setupBeforeClass(): void
{
if (!class_exists(\MongoDB\Client::class)) {
if (!class_exists(Client::class)) {
throw new SkippedTestSuiteError('The mongodb/mongodb package is required.');
}

Expand Down

0 comments on commit 759554c

Please sign in to comment.