Skip to content

Commit

Permalink
[HttpKernel] Fix MongoDbProfilerStorageTest
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Mar 20, 2012
1 parent 05c523a commit 979c02b
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,23 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;

public static function tearDownAfterClass()
{
if (self::$storage) {
self::$storage->purge();
}
}

protected function setUp()
static public function setUpBeforeClass()
{
if (extension_loaded('mongo')) {
self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
try {
self::$storage->getMongo();
self::$storage->purge();
} 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;
}
}

Expand All @@ -71,4 +69,13 @@ protected function getStorage()
{
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');
}
}
}

0 comments on commit 979c02b

Please sign in to comment.