8000 Updated the tests so that tests will be marked as skipped when there … · Seldaek/symfony@41b7a19 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41b7a19

Browse files
committed
Updated the tests so that tests will be marked as skipped when there is no MongoDB server present!
1 parent 233c7db commit 41b7a19

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/Symfony/Tests/Component/HttpKernel/Profiler/MongoDbProfilerStorageTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
/*
43
* This file is part of the Symfony package.
54
*
@@ -14,14 +13,25 @@
1413
use Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage;
1514
use Symfony\Component\HttpKernel\Profiler\Profile;
1615

16+
class DummyMongoDbProfilerStorage extends MongoDbProfilerStorage {
17+
public function getMongo() {
18+
return parent::getMongo();
19+
}
20+
}
21+
1722
class MongoDbProfilerStorageTest extends \PHPUnit_Framework_TestCase
1823
{
1924
protected static $storage;
2025

2126
protected function setUp()
2227
{
2328
if (extension_loaded('mongo')) {
24-
self::$storage = new MongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data');
29+
self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data');
30+
try {
31+
self::$storage->getMongo();
32+
} catch(\MongoConnectionException $e) {
33+
$this->markTestSkipped('MongoDbProfilerStorageTest requires that there is a MongoDB server present on localhost');
34+
}
2535
self::$storage->purge();
2636
} else {
2737
$this->markTestSkipped('MongoDbProfilerStorageTest requires that the extension mongo is loaded');

0 commit comments

Comments
 (0)
0