public function testCreateCollectionCappedOptionsAreCast() { $mongoDB = $this->getMockMongoDB(); $mongoDB->expects($this->once())->method('createCollection')->with('foo', ['capped' => false, 'size' => 0, 'max' => 0]); $mongoDB->expects($this->once())->method('selectCollection')->with('foo')->will($this->returnValue($this->getMockMongoCollection())); $database = new Database($this->getMockConnection(), $mongoDB, $this->getMockEventManager()); $collection = $database->createCollection('foo', ['capped' => 0, 'size' => null, 'max' => null]); $this->assertInstanceOf('Doctrine\\MongoDB\\Collection', $collection); }
public function testCreateCollectionCappedOptionsAreCast() { $mongoDB = $this->getMockMongoDB(); if (version_compare(phpversion('mongo'), '1.4.0', '>=')) { $mongoDB->expects($this->once())->method('createCollection')->with('foo', array('capped' => false, 'size' => 0, 'max' => 0)); } else { $mongoDB->expects($this->once())->method('createCollection')->with('foo', false, 0, 0); } $mongoDB->expects($this->once())->method('selectCollection')->with('foo')->will($this->returnValue($this->getMockMongoCollection())); $database = new Database($this->getMockConnection(), $mongoDB, $this->getMockEventManager()); $collection = $database->createCollection('foo', array('capped' => 0, 'size' => null, 'max' => null)); $this->assertInstanceOf('Doctrine\\MongoDB\\Collection', $collection); }
/** * @see Database::createCollection() */ public function createCollection($name, $cappedOrOptions = false, $size = 0, $max = 0) { $options = is_array($cappedOrOptions) ? array_merge(['capped' => false, 'size' => 0, 'max' => 0], $cappedOrOptions) : ['capped' => $cappedOrOptions, 'size' => $size, 'max' => $max]; $this->log(['createCollection' => true, 'name' => $name, 'options' => $options, 'capped' => $options['capped'], 'size' => $options['size'], 'max' => $options['max']]); return parent::createCollection($name, $options); }
/** @proxy */ public function createCollection($name, $capped = false, $size = 0, $max = 0) { $this->log(array('createCollection' => true, 'capped' => $capped, 'size' => $size, 'max' => $max)); return parent::createCollection($name, $capped, $size, $max); }