Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2aca92b

Browse files
committed
Do not run mongodb tests if the server is not available
1 parent 87c9739 commit 2aca92b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Lock\Tests\Store;
1313

1414
use MongoDB\Client;
15+
use MongoDB\Driver\Exception\ConnectionTimeoutException;
1516
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1617
use Symfony\Component\Lock\Exception\NotSupportedException;
1718
use Symfony\Component\Lock\Key;
@@ -30,8 +31,12 @@ class MongoDbStoreTest extends AbstractStoreTest
3031

3132
public static function setupBeforeClass(): void
3233
{
33-
$client = self::getMongoClient();
34-
$client->listDatabases();
34+
try {
35+
$client = self::getMongoClient();
36+
$client->listDatabases();
37+
} catch (ConnectionTimeoutException $e) {
38+
self::markTestSkipped('No mongodb server running.');
39+
}
3540
}
3641

3742
private static function getMongoClient(): Client

0 commit comments

Comments
 (0)