public function testReplaceSessionData() {
$collection = $this
->getMockBuilder('MongoCollection')
->disableOriginalConstructor()
->getMock();
$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);
}