From 0761234eee55efee048a136be220d139b75a3a9a Mon Sep 17 00:00:00 2001 From: Andrew Revak Date: Thu, 7 May 2015 00:46:57 -0700 Subject: [PATCH] LOG4PHP-222 Switch to use MongoClient instead of Mongo which is deprecated and updated tests --- src/main/php/appenders/LoggerAppenderMongoDB.php | 2 +- src/test/php/appenders/LoggerAppenderMongoDBTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/php/appenders/LoggerAppenderMongoDB.php b/src/main/php/appenders/LoggerAppenderMongoDB.php index c0f2c2d..0f31445 100644 --- a/src/main/php/appenders/LoggerAppenderMongoDB.php +++ b/src/main/php/appenders/LoggerAppenderMongoDB.php @@ -122,7 +122,7 @@ class LoggerAppenderMongoDB extends LoggerAppender { */ public function activateOptions() { try { - $this->connection = new Mongo(sprintf('%s:%d', $this->host, $this->port), array('timeout' => $this->timeout)); + $this->connection = new MongoClient(sprintf('%s:%d', $this->host, $this->port), array('timeout' => $this->timeout)); $db = $this->connection->selectDB($this->databaseName); if ($this->userName !== null && $this->password !== null) { $authResult = $db->authenticate($this->userName, $this->password); diff --git a/src/test/php/appenders/LoggerAppenderMongoDBTest.php b/src/test/php/appenders/LoggerAppenderMongoDBTest.php index 7d62fe5..d70e28f 100644 --- a/src/test/php/appenders/LoggerAppenderMongoDBTest.php +++ b/src/test/php/appenders/LoggerAppenderMongoDBTest.php @@ -102,7 +102,7 @@ class LoggerAppenderMongoDBTest extends PHPUnit_Framework_TestCase { public function testActivateOptions() { $this->appender->activateOptions(); - $this->assertInstanceOf('Mongo', $this->appender->getConnection()); + $this->assertInstanceOf('MongoClient', $this->appender->getConnection()); $this->assertInstanceOf('MongoCollection', $this->appender->getCollection()); } @@ -110,7 +110,7 @@ class LoggerAppenderMongoDBTest extends PHPUnit_Framework_TestCase { $this->appender->setUserName(null); $this->appender->setPassword(null); $this->appender->activateOptions(); - $this->assertInstanceOf('Mongo', $this->appender->getConnection()); + $this->assertInstanceOf('MongoClient', $this->appender->getConnection()); $this->assertInstanceOf('MongoCollection', $this->appender->getCollection()); } @ -183,7 +183,7 @@ class LoggerAppenderMongoDBTest extends PHPUnit_Framework_TestCase { public function testClose() { $this->appender->activateOptions(); - $this->assertInstanceOf('Mongo', $this->appender->getConnection()); + $this->assertInstanceOf('MongoClient', $this->appender->getConnection()); $this->assertInstanceOf('MongoCollection', $this->appender->getCollection()); $this->appender->close(); $this->assertNull($this->appender->getConnection()); -- 1.9.1