예제 #1
0
 protected function setUp()
 {
     if (!class_exists('Mongo')) {
         $this->markTestSkipped('Mongo is not installed');
     }
     $mongo = new \MongoClient();
     $this->module = new MongoDb(make_container());
     $this->module->_setConfig($this->mongoConfig);
     $this->module->_initialize();
     $this->db = $mongo->selectDB('test');
     $this->userCollection = $this->db->createCollection('users');
     $this->userCollection->insert(array('id' => 1, 'email' => '*****@*****.**'));
 }
예제 #2
0
 protected function setUp()
 {
     if (!class_exists('Mongo')) {
         $this->markTestSkipped('Mongo is not installed');
     }
     $mongo = new \Mongo();
     $this->module = new MongoDb();
     $this->module->_setConfig($this->mongoConfig);
     $this->module->_initialize();
     $this->db = $mongo->selectDB('test');
     $this->userCollection = $this->db->createCollection('users');
     $user_id = $this->userCollection->insert(array('id' => 1, 'email' => '*****@*****.**'));
     $this->assertInternalType('string', $user_id);
 }
예제 #3
0
 protected function setUp()
 {
     if (!class_exists('\\MongoDB\\Client')) {
         $this->markTestSkipped('MongoDB is not installed');
     }
     $mongo = new \MongoDB\Client();
     $this->module = new MongoDb(make_container());
     $this->module->_setConfig($this->mongoConfig);
     try {
         $this->module->_initialize();
     } catch (ModuleException $e) {
         $this->markTestSkipped($e->getMessage());
     }
     $this->db = $mongo->selectDatabase('test');
     $this->userCollection = $this->db->users;
     $this->userCollection->insertOne(array('id' => 1, 'email' => '*****@*****.**'));
 }