Permalink
Browse files

Connection::log() should NOP without a logger callable (fixes #99)

  • Loading branch information...
jmikola committed Mar 18, 2013
1 parent cc8685e commit ac94f9a10ac715bc77eb0b3fe96e1e90ebbdf655
Showing with 11 additions and 1 deletion.
  1. +3 −1 lib/Doctrine/MongoDB/Connection.php
  2. +8 −0 tests/Doctrine/MongoDB/Tests/ConnectionTest.php
@@ -145,7 +145,9 @@ public function isConnected()
*/
public function log(array $log)
{
- call_user_func_array($this->config->getLoggerCallable(), array($log));
+ if (null !== $this->config->getLoggerCallable()) {
+ call_user_func_array($this->config->getLoggerCallable(), array($log));
+ }
}
/**
@@ -43,6 +43,14 @@ public function testLog()
$this->assertEquals(array('test'), $called);
}
+ public function testLogShouldDoNothingWithoutLoggerCallable()
+ {
+ $conn = new Connection();
+ $conn->log(array('test'));
+
+ $this->assertNull($conn->getConfiguration()->getLoggerCallable());
+ }
+
public function testSetMongo()
{
if (version_compare(phpversion('mongo'), '1.3.0', '>=')) {

0 comments on commit ac94f9a

Please sign in to comment.