modified MongoDbCommand __toString output

This commit is contained in:
Anton Grebnev
2012-06-04 16:06:03 +04:00
parent f6e119d372
commit 950d1f4a9a
2 changed files with 14 additions and 14 deletions

View File

@ -329,23 +329,23 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
{
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COUNT, new CollectionMock());
$cmd->bindParam('condition', array());
$this->assertStringStartsWith('Collection: CollectionMock', $cmd->__toString());
$this->assertStringStartsWith(PHP_EOL . 'Collection: CollectionMock', $cmd->__toString());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, new CollectionMock());
$cmd->bindParam('condition', array());
$this->assertStringStartsWith('Collection: CollectionMock', $cmd->__toString());
$this->assertStringStartsWith(PHP_EOL . 'Collection: CollectionMock', $cmd->__toString());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock());
$this->assertSame('Command properties not set', $cmd->__toString());
$cmd->bindParam('command', array());
$this->assertStringStartsWith('Collection: CollectionMock', $cmd->__toString());
$this->assertStringStartsWith(PHP_EOL . 'Collection: CollectionMock', $cmd->__toString());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection);
$this->assertSame('Command properties not set', $cmd->__toString());
$cmd
->bindParam('data', array('name' => 'insert'))
->bindParam('safe', true);
$this->assertStringStartsWith('Collection: ', $cmd->__toString());
$this->assertStringStartsWith(PHP_EOL . 'Collection: ', $cmd->__toString());
$this->assertContains('Bulk insert: FALSE', $cmd->__toString());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection);
@ -357,14 +357,14 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertContains('Bulk insert: TRUE', $cmd->__toString());
$cmd->bindParam('condition', array('name' => 'insert'))->bindParam('fields', array());
$this->assertStringStartsWith('Collection: ', $cmd->__toString());
$this->assertStringStartsWith(PHP_EOL . 'Collection: ', $cmd->__toString());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::REMOVE, $this->collection);
$this->assertSame('Command properties not set', $cmd->__toString());
$cmd
->bindParam('condition', array('name' => 'insert'))
->bindParam('safe', true);
$this->assertStringStartsWith('Collection: ', $cmd->__toString());
$this->assertStringStartsWith(PHP_EOL . 'Collection: ', $cmd->__toString());
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::UPDATE, $this->collection);
$this->assertSame('Command properties not set', $cmd->__toString());
@ -373,7 +373,7 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
->bindParam('data', array('$set' => array('name' => 'update')))
->bindParam('upsert', false)
->bindParam('safe', true);
$this->assertStringStartsWith('Collection: ', $cmd->__toString());
$this->assertStringStartsWith(PHP_EOL . 'Collection: ', $cmd->__toString());
}
}
@ -383,6 +383,6 @@ class CollectionMock
public function __toString()
{
return 'CollectionMock';
return PHP_EOL . 'CollectionMock';
}
}