From 623666fb09392f819e694e102a225c257595ef2d Mon Sep 17 00:00:00 2001 From: Anton Grebnev Date: Mon, 2 Apr 2012 15:27:33 +0400 Subject: [PATCH] updated MongoDbCommand Profiler output --- model/MongoDbCommand.php | 26 +++++++++++++------------- tests/model/MongoDbCommandTest.php | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/model/MongoDbCommand.php b/model/MongoDbCommand.php index 4eae91e..c82c430 100644 --- a/model/MongoDbCommand.php +++ b/model/MongoDbCommand.php @@ -97,11 +97,11 @@ class FindMongoCommand extends MongoDbCommand public function __toString() { if ($this->checkParams()) { - $result = 'Collection: ' . $this->collection . PHP_EOL; + $result = PHP_EOL . 'Collection: ' . $this->collection . PHP_EOL; ob_start(); var_dump($this->condition); $condition = ob_get_clean(); - $result .= 'Condition: ' . $condition . PHP_EOL; + $result .= 'Condition: ' . $condition; $result .= 'Type: FIND' . PHP_EOL; ob_start(); var_dump($this->fields); @@ -143,12 +143,12 @@ class CountMongoCommand extends MongoDbCommand public function __toString() { if ($this->checkParams()) { - $result = 'Collection: ' . $this->collection . PHP_EOL; + $result = PHP_EOL . 'Collection: ' . $this->collection . PHP_EOL; $result .= 'Type: COUNT' . PHP_EOL; ob_start(); var_dump($this->condition); $condition = ob_get_clean(); - $result .= 'Condition: ' . $condition . PHP_EOL; + $result .= 'Condition: ' . $condition; $result .= 'Limit: ' . $this->limit . PHP_EOL; $result .= 'Skip: ' . $this->skip . PHP_EOL; return $result; @@ -199,12 +199,12 @@ class InsertMongoCommand extends MongoDbCommand public function __toString() { if ($this->checkParams()) { - $result = 'Collection: ' . $this->collection . PHP_EOL; + $result = PHP_EOL . 'Collection: ' . $this->collection . PHP_EOL; $result .= 'Type: INSERT' . PHP_EOL; ob_start(); var_dump($this->data); $data = ob_get_clean(); - $result .= 'Data: ' . $data . PHP_EOL; + $result .= 'Data: ' . $data; $mult = $this->multiple ? 'TRUE' : 'FALSE'; $result .= 'Bulk insert: ' . $mult . PHP_EOL; $safe = $this->safe ? 'TRUE' : 'FALSE'; @@ -248,16 +248,16 @@ class UpdateMongoCommand extends MongoDbCommand public function __toString() { if ($this->checkParams()) { - $result = 'Collection: ' . $this->collection . PHP_EOL; + $result = PHP_EOL . 'Collection: ' . $this->collection . PHP_EOL; $result .= 'Type: UPDATE' . PHP_EOL; ob_start(); var_dump($this->condition); $condition = ob_get_clean(); - $result .= 'Condition: ' . $condition . PHP_EOL; + $result .= 'Condition: ' . $condition; ob_start(); var_dump($this->data); $data = ob_get_clean(); - $result .= 'Data: ' . $data . PHP_EOL; + $result .= 'Data: ' . $data; $mult = $this->multiple ? 'TRUE' : 'FALSE'; $result .= 'Multiple fields: ' . $mult . PHP_EOL; $upsert = $this->upsert ? 'TRUE' : 'FALSE'; @@ -294,12 +294,12 @@ class RemoveMongoCommand extends MongoDbCommand public function __toString() { if ($this->checkParams()) { - $result = 'Collection: ' . $this->collection . PHP_EOL; + $result = PHP_EOL . 'Collection: ' . $this->collection . PHP_EOL; $result .= 'Type: REMOVE' . PHP_EOL; ob_start(); var_dump($this->condition); $condition = ob_get_clean(); - $result .= 'Condition: ' . $condition . PHP_EOL; + $result .= 'Condition: ' . $condition; $safe = $this->safe ? 'TRUE' : 'FALSE'; $result .= 'Safe operation: ' . $safe . PHP_EOL; return $result; @@ -335,12 +335,12 @@ class CommandMongoCommand extends MongoDbCommand public function __toString() { if ($this->checkParams()) { - $result = 'Collection: ' . $this->collection . PHP_EOL; + $result = PHP_EOL . 'Collection: ' . $this->collection . PHP_EOL; $result .= 'Type: COMMAND' . PHP_EOL; ob_start(); var_dump($this->command); $command = ob_get_clean(); - $result .= 'Command: ' . $command . PHP_EOL; + $result .= 'Command: ' . $command; return $result; } else { return 'Command properties not set'; diff --git a/tests/model/MongoDbCommandTest.php b/tests/model/MongoDbCommandTest.php index 1963318..69fe5b5 100644 --- a/tests/model/MongoDbCommandTest.php +++ b/tests/model/MongoDbCommandTest.php @@ -330,7 +330,7 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COUNT, new CollectionMock()); $cmd->bindParam('condition', array()); $this->assertStringStartsWith('Collection: CollectionMock', $cmd->__toString()); - + $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, new CollectionMock()); $cmd->bindParam('condition', array()); $this->assertStringStartsWith('Collection: CollectionMock', $cmd->__toString());