You are here

public function MongoDbSessionHandlerTest::testReplaceSessionData 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::testReplaceSessionData()

File

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

Class

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

Namespace

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

Code

public function testReplaceSessionData() {
  $collection = $this
    ->createMongoCollectionMock();
  $this->mongo
    ->expects($this
    ->once())
    ->method('selectCollection')
    ->with($this->options['database'], $this->options['collection'])
    ->will($this
    ->returnValue($collection));
  $data = array();
  $collection
    ->expects($this
    ->exactly(2))
    ->method('update')
    ->will($this
    ->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
    $data = $updateData;
  }));
  $this->storage
    ->write('foo', 'bar');
  $this->storage
    ->write('foo', 'foobar');
  $this
    ->assertEquals('foobar', $data['$set'][$this->options['data_field']]->bin);
}