Example #1
0
 public function setUp()
 {
     // connect to mongo
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     // select database
     $this->database = $client->getDatabase('test');
 }
Example #2
0
 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $this->database = $client->getDatabase('test');
 }
Example #3
0
 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $this->database = $client->getDatabase('test');
     $this->queue = $this->database->getQueue('queue_channel');
 }
Example #4
0
 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $database = $client->getDatabase('test');
     // select collection
     $this->collection = $database->getCollection('phpmongo_test_collection');
 }
Example #5
0
 public function setUp()
 {
     // connect to mongo
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     // select database
     $database = $client->getDatabase('test');
     // select collection
     $this->collection = $database->getCollection('phpmongo_test_collection');
 }
Example #6
0
 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     if (version_compare($client->getDbVersion(), '2.6.0', '<')) {
         $this->markTestSkipped('Current primary does not have a Write API support.');
     }
     // select database
     $database = $client->getDatabase('test');
     $this->collection = $database->getCollection('phpmongo_test_collection');
 }
Example #7
0
 public function setUp()
 {
     $client = new Client();
     $this->cache = $client->getDatabase('test')->getCache('cache_namespace')->init();
 }
Example #8
0
 public function testStoreDocumentInPool_DocumentAlreadyStored()
 {
     /**
      * Store document to pool
      */
     $this->assertTrue($this->collection->isDocumentPoolEmpty());
     $document = $this->collection->createDocument(array('param' => 'value'))->save();
     $this->assertFalse($this->collection->isDocumentPoolEmpty());
     /**
      * Modify document in another thread
      */
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $client->getDatabase($document->getCollection()->getDatabase()->getName())->getCollection($document->getCollection()->getName())->find()->findOne()->set('param', 'updatedValue')->save();
     // here oroginal document must be in unconsisted state
     $this->assertEquals('value', $document->get('param'));
     // overload document in pool with new data
     $this->collection->find()->findOne();
     $this->assertEquals('updatedValue', $document->get('param'));
 }
Example #9
0
 public function setUp()
 {
     $client = new Client();
     $this->database = $client->getDatabase('test');
     $this->gridFs = $this->database->getGridFs('images');
 }
Example #10
0
 public function setUp()
 {
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $this->database = $client->getDatabase('test');
     $this->gridFs = $this->database->getGridFs('images');
 }
Example #11
0
 /**
  * @expectedException \Sokil\Mongo\Exception
  * @expectedExceptionMessage Database not selected
  */
 public function testGetDatabase_NameNotSpecified_DefaultNameNotSpecified()
 {
     $client = new Client('mongodb://127.0.0.1/');
     $this->assertEquals('some_name', $client->getDatabase()->getName());
 }
Example #12
0
 public function setUp()
 {
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $database = $client->getDatabase('test');
     $this->collection = $database->getCollection('phpmongo_test_collection')->delete();
 }
Example #13
0
 public function setUp()
 {
     $client = new Client();
     $database = $client->getDatabase('test');
     $this->collection = $database->getCollection('phpmongo_test_collection')->delete();
 }
Example #14
0
 public function setUp()
 {
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     $this->cache = $client->getDatabase('test')->getCache('cache_namespace')->init();
 }