8000 Check for mongodb/mongodb lib in lock tests · symfony/symfony@6602c02 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6602c02

Browse files
committed
Check for mongodb/mongodb lib in lock tests
1 parent 4bc1a4a commit 6602c02

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ class MongoDbSessionHandlerTest extends TestCase
3232
private $storage;
3333
public $options;
3434

35-
protected function setUp(): void
35+
public static function setUpBeforeClass(): void
3636
{
37-
parent::setUp();
38-
3937
if (!class_exists(Client::class)) {
40-
$this->markTestSkipped('The mongodb/mongodb package is required.');
38+
throw new SkippedTestSuiteError('The mongodb/mongodb package is required.');
4139
}
40+
}
41+
42+
protected function setUp(): void
43+
{
44+
parent::setUp();
4245

4346
$this->mongo = $this->getMockBuilder(Client::class)
4447
->disableOriginalConstructor()

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14+
use MongoDB\Collection;
15+
use PHPUnit\Framework\SkippedTestSuiteError;
1416
use PHPUnit\Framework\TestCase;
1517
use Symfony\Component\Lock\Store\MongoDbStore;
1618
use Symfony\Component\Lock\Store\StoreFactory;
@@ -22,9 +24,16 @@
2224
*/
2325
class MongoDbStoreFactoryTest extends TestCase
2426
{
27+
public static function setupBeforeClass(): void
28+
{
29+
if (!class_exists(Client::class)) {
30+
throw new SkippedTestSuiteError('The mongodb/mongodb package is required.');
31+
}
32+
}
33+
2534
public function testCreateMongoDbCollectionStore()
2635
{
27-
$store = StoreFactory::createStore($this->createMock(\MongoDB\Collection::class));
36+
$store = StoreFactory::createStore($this->createMock(Collection::class));
2837

2938
$this->assertInstanceOf(MongoDbStore::class, $store);
3039
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MongoDbStoreTest extends AbstractStoreTestCase
3232

3333
public static function setupBeforeClass(): void
3434
{
35-
if (!class_exists(\MongoDB\Client::class)) {
35+
if (!class_exists(Client::class)) {
3636
throw new SkippedTestSuiteError('The mongodb/mongodb package is required.');
3737
}
3838

0 commit comments

Comments
 (0)
0