refactored MongoModel to hide fetch method, fixed PHPDoc errors

This commit is contained in:
Anton Grebnev
2012-10-19 20:15:26 +04:00
parent efb6c2d34c
commit 11a5968105
14 changed files with 436 additions and 187 deletions

View File

@ -16,7 +16,7 @@ require_once dirname(__FILE__) . '/../../model/MongoDriver.php';
require_once dirname(__FILE__) . '/../../model/MongoDbCommand.php';
require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
class MongoDbCommandTest extends PHPUnit_Framework_TestCase
class MongoDbCommandTest extends PHPUnit_Framework_TestCase
{
private $conf = array();
@ -323,11 +323,14 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
*/
public function testToString()
{
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COUNT, new CollectionMock());
$cmd->bindParam('condition', array());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COUNT);
$this->assertSame('Command properties not set', $cmd->__toString());
$cmd->bindParam('collection', new CollectionMock());
$this->assertStringStartsWith("\n" . 'Collection: CollectionMock', $cmd->__toString());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, new CollectionMock());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND);
$this->assertSame('Command properties not set', $cmd->__toString());
$cmd->bindParam('collection', new CollectionMock());
$cmd->bindParam('condition', array());
$this->assertStringStartsWith("\n" . 'Collection: CollectionMock', $cmd->__toString());
$this->assertContains('Condition: ' . '[]' . PHP_EOL, $cmd->__toString());