Inheritance: extends My_ShantyMongo_Abstract
 public function testInsertBatch()
 {
     $data = array(array('_id' => new MongoId('4c04d5101f5f5e21361e3ab6'), 'name' => 'green', 'hex' => '006600'), array('_id' => new MongoId('4c04d5101f5f5e21361e3ab7'), 'name' => 'blue', 'hex' => '0000CC'), array('_id' => new MongoId('4c04d5101f5f5e21361e3ab8'), 'name' => 'red', 'hex' => 'FF0000'));
     My_ShantyMongo_Simple::insertBatch($data, array('safe' => true));
     $colours = My_ShantyMongo_Simple::all();
     $colour = $colours->getNext();
     $this->assertEquals('green', $colour->name);
     $this->assertEquals(3, $colours->count());
 }
Example #2
0
 public function testDeleteSafe()
 {
     $reader = new Mongo('mongodb://' . TESTS_SHANTY_MONGO_CONNECTIONSTRING);
     $readerDB = $reader->{TESTS_SHANTY_MONGO_DB};
     for ($nr = 0; $nr < 1000; $nr++) {
         $entry = new My_ShantyMongo_Simple(array('data' => '123'));
         $entry->save();
         $entry->delete();
         $found = $readerDB->simple->findOne(array('_id' => $entry->getId()));
         if (!is_null($found)) {
             print $nr;
             die;
         }
         $this->assertNull($found);
     }
 }