merged branch vicb/profiler/mongo/fix (PR #3650)
Commits
-------
979c02b
[HttpKernel] Fix MongoDbProfilerStorageTest
Discussion
----------
[HttpKernel] Fix MongoDbProfilerStorageTest
* The test was failing if no connection (trying to call purge)
* The extension / connection was tested before each single test
This commit is contained in:
commit
b5c5212163
@ -26,25 +26,23 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
|
|||||||
{
|
{
|
||||||
protected static $storage;
|
protected static $storage;
|
||||||
|
|
||||||
public static function tearDownAfterClass()
|
static public function setUpBeforeClass()
|
||||||
{
|
|
||||||
if (self::$storage) {
|
|
||||||
self::$storage->purge();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp()
|
|
||||||
{
|
{
|
||||||
if (extension_loaded('mongo')) {
|
if (extension_loaded('mongo')) {
|
||||||
self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
|
self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
|
||||||
try {
|
try {
|
||||||
self::$storage->getMongo();
|
self::$storage->getMongo();
|
||||||
self::$storage->purge();
|
|
||||||
} catch (\MongoConnectionException $e) {
|
} catch (\MongoConnectionException $e) {
|
||||||
$this->markTestSkipped('MongoDbProfilerStorageTest requires that there is a MongoDB server present on localhost');
|
self::$storage = null;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
$this->markTestSkipped('MongoDbProfilerStorageTest requires that the extension mongo is loaded');
|
}
|
||||||
|
|
||||||
|
static public function tearDownAfterClass()
|
||||||
|
{
|
||||||
|
if (self::$storage) {
|
||||||
|
self::$storage->purge();
|
||||||
|
self::$storage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,4 +69,13 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
|
|||||||
{
|
{
|
||||||
return self::$storage;
|
return self::$storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
if (self::$storage) {
|
||||||
|
self::$storage->purge();
|
||||||
|
} else {
|
||||||
|
$this->markTestSkipped('MongoDbProfilerStorageTest requires then mongo PHP extennsion and a MongoDB server on localhost');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user