added methods to MongoDriver for custom commands, findAndModify, count
This commit is contained in:
@ -84,7 +84,7 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
|
||||
->bindParam('condition', array('name' => 'insert'))
|
||||
->bindParam('fields', array())
|
||||
->bindParam('multiple', false);
|
||||
|
||||
|
||||
$result = $cmd->execute();
|
||||
$this->assertEquals('insert', $result['name']);
|
||||
}
|
||||
@ -199,4 +199,26 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
|
||||
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::REMOVE, $this->collection);
|
||||
$cmd->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage CommandMongoCommand error. Bind all required params first.
|
||||
*/
|
||||
public function testCommandCommandNotAllParamsBinded()
|
||||
{
|
||||
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, $this->collection);
|
||||
$cmd->execute();
|
||||
}
|
||||
|
||||
public function testCommandCommandNotMongoDb()
|
||||
{
|
||||
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock());
|
||||
$cmd->bindParam('command', array());
|
||||
$this->assertFalse($cmd->execute());
|
||||
}
|
||||
}
|
||||
|
||||
class CollectionMock
|
||||
{
|
||||
public $db = array();
|
||||
}
|
||||
|
Reference in New Issue
Block a user