enableCollectionPool() public method

Example #1
0
 public function testEnableCollectionPool()
 {
     $this->database->clearCollectionPool();
     // disable collection pool
     $this->database->disableCollectionPool();
     $this->assertFalse($this->database->isCollectionPoolEnabled());
     // create collection
     $this->database->getCollection('phpmongo_test_collection_1');
     // check if collection in pool
     $this->assertTrue($this->database->isCollectionPoolEmpty());
     // enable collection pool
     $this->database->enableCollectionPool();
     $this->assertTrue($this->database->isCollectionPoolEnabled());
     // read collection to pool
     $this->database->getCollection('phpmongo_test_collection_2');
     // check if document in pool
     $this->assertFalse($this->database->isCollectionPoolEmpty());
     // clear document pool
     $this->database->clearCollectionPool();
     $this->assertTrue($this->database->isCollectionPoolEmpty());
     // disable document pool
     $this->database->disableCollectionPool();
     $this->assertFalse($this->database->isCollectionPoolEnabled());
 }