public function testDefaultSafeOptions()
{
$this->_db = new MongoDb($this->_testConfig + array('w' => 1, 'wTimeoutMS' => 10000));
$this->_db->server = new MockMongoConnection();
$this->_db->connection = new MockCallable();
$this->_db->connection->custom = new MockCallable();
$query = new Query(array('type' => 'read', 'source' => 'custom'));
$this->_db->create($query);
$result = $this->_db->connection->custom->call;
$expected = array(null, array('w' => 1, 'wTimeoutMS' => 10000, 'fsync' => false));
$this->assertEqual('insert', $result['method']);
$this->assertEqual($expected, $result['params']);
$query = new Query(array('type' => 'read', 'source' => 'custom', 'data' => array('something')));
$this->_db->update($query);
$result = $this->_db->connection->custom->call;
$expected = array('upsert' => false, 'multiple' => true, 'w' => 1, 'wTimeoutMS' => 10000, 'fsync' => false);
$this->assertEqual('update', $result['method']);
$this->assertEqual($expected, $result['params'][2]);
$query = new Query(array('type' => 'read', 'source' => 'custom'));
$this->_db->delete($query);
$result = $this->_db->connection->custom->call;
$expected = array('justOne' => false, 'w' => 1, 'wTimeoutMS' => 10000, 'fsync' => false);
$this->assertEqual('remove', $result['method']);
$this->assertEqual($expected, $result['params'][1]);
$this->_db = new MongoDb($this->_testConfig + array('w' => 1, 'wTimeoutMS' => 10000));
$this->_db->server = new MockMongoConnection();
$this->_db->connection = new MockCallable();
$this->_db->connection->custom = new MockCallable();
$query = new Query(array('type' => 'read', 'source' => 'custom'));
$this->_db->create($query);
$result = $this->_db->connection->custom->call;
$expected = array(null, array('w' => 1, 'wTimeoutMS' => 10000, 'fsync' => false));
$this->assertEqual('insert', $result['method']);
$this->assertEqual($expected, $result['params']);
$query = new Query(array('type' => 'read', 'source' => 'custom', 'data' => array('something')));
$this->_db->update($query);
$result = $this->_db->connection->custom->call;
$expected = array('upsert' => false, 'multiple' => true, 'w' => 1, 'wTimeoutMS' => 10000, 'fsync' => false);
$this->assertEqual('update', $result['method']);
$this->assertEqual($expected, $result['params'][2]);
$query = new Query(array('type' => 'read', 'source' => 'custom'));
$this->_db->delete($query);
$result = $this->_db->connection->custom->call;
$expected = array('justOne' => false, 'w' => 1, 'wTimeoutMS' => 10000, 'fsync' => false);
$this->assertEqual('remove', $result['method']);
$this->assertEqual($expected, $result['params'][1]);
}