Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
 /**
  * @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);
 }
Example #4
0
 /** @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);
 }