public function setUp() { // connect to mongo $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null); // select database $this->database = $client->getDatabase('test'); }
public function setUp() { // connect to mongo $client = new Client(); // select database $this->database = $client->getDatabase('test'); }
public function setUp() { // connect to mongo $client = new Client(); // select database $this->database = $client->getDatabase('test'); $this->queue = $this->database->getQueue('queue_channel'); }
public function setUp() { // connect to mongo $client = new Client(); // select database $database = $client->getDatabase('test'); // select collection $this->collection = $database->getCollection('phpmongo_test_collection'); }
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'); }
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'); }
public function setUp() { $client = new Client(); $this->cache = $client->getDatabase('test')->getCache('cache_namespace')->init(); }
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')); }
public function setUp() { $client = new Client(); $this->database = $client->getDatabase('test'); $this->gridFs = $this->database->getGridFs('images'); }
public function setUp() { $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null); $this->database = $client->getDatabase('test'); $this->gridFs = $this->database->getGridFs('images'); }
/** * @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()); }
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(); }
public function setUp() { $client = new Client(); $database = $client->getDatabase('test'); $this->collection = $database->getCollection('phpmongo_test_collection')->delete(); }
public function setUp() { $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null); $this->cache = $client->getDatabase('test')->getCache('cache_namespace')->init(); }