public function testCappedCollectionInsert() { $this->collection = $this->database->createCappedCollection('capped_collection', 3, 30); $this->collection->createDocument(array('param' => 1))->save(); $this->collection->createDocument(array('param' => 2))->save(); $this->collection->createDocument(array('param' => 3))->save(); $this->collection->createDocument(array('param' => 4))->save(); $this->assertEquals(3, $this->collection->find()->count()); $documents = $this->collection->find(); $this->assertEquals(2, $documents->current()->param); $documents->next(); $this->assertEquals(3, $documents->current()->param); $documents->next(); $this->assertEquals(4, $documents->current()->param); $this->collection->delete(); }
/** * @expectedException Sokil\Mongo\Exception * @expectedExceptionMessage Size or number of elements must be defined */ public function testCreateCappedCollection() { $this->database->createCappedCollection('collection', 'swong_size', 'wrong_number'); }