public function MongoDbSessionHandlerTest::testGc in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\MongoDbSessionHandlerTest::testGc()
File
- vendor/
symfony/ http-foundation/ Tests/ Session/ Storage/ Handler/ MongoDbSessionHandlerTest.php, line 221
Class
- MongoDbSessionHandlerTest
- @author Markus Bachmann <markus.bachmann@bachi.biz>
Namespace
Symfony\Component\HttpFoundation\Tests\Session\Storage\HandlerCode
public function testGc() {
$collection = $this
->createMongoCollectionMock();
$this->mongo
->expects($this
->once())
->method('selectCollection')
->with($this->options['database'], $this->options['collection'])
->will($this
->returnValue($collection));
$that = $this;
$collection
->expects($this
->once())
->method('remove')
->will($this
->returnCallback(function ($criteria) use ($that) {
$that
->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$lt']);
$that
->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['expiry_field']]['$lt']->sec);
}));
$this
->assertTrue($this->storage
->gc(1));
}