You are here

protected function MongoDbSessionHandlerTest::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\MongoDbSessionHandlerTest::setUp()

File

vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php, line 28

Class

MongoDbSessionHandlerTest
@author Markus Bachmann <markus.bachmann@bachi.biz>

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler

Code

protected function setUp() {
  if (!extension_loaded('mongo')) {
    $this
      ->markTestSkipped('MongoDbSessionHandler requires the PHP "mongo" extension.');
  }
  $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
  $this->mongo = $this
    ->getMockBuilder($mongoClass)
    ->getMock();
  $this->options = array(
    'id_field' => '_id',
    'data_field' => 'data',
    'time_field' => 'time',
    'expiry_field' => 'expires_at',
    'database' => 'sf2-test',
    'collection' => 'session-test',
  );
  $this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
}