[pkg-php-pear] Bug#882944: php-monolog FTBFS with phpunit 6.4.4-2

Nishanth Aravamudan nish.aravamudan at canonical.com
Tue Feb 13 23:01:12 UTC 2018


Package: php-monolog
Version: 1.23.0-1
Followup-For: Bug #882944
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch

Dear Maintainer,


In Ubuntu, the attached patch was applied to achieve the following:


  * debian/patches/phpunit6_compatibility_changes.patch: PHPUnit 6 is
    not backwards compatible in various ways.  Closes LP: #1749001.
  * debian/patches/mongodb_fixes.patch: Multiple upstream MongoDB
    handler changes.

I had to backport a lot of changes from upstream to get the build to
succeed and to get the DEP8 tests to pass.

I'm most unhappy with the redis/predis stuff, but I think it's actually
a bug in libphp-predis, which does not ship an autoload.php file?


Thanks for considering the patch.

*** /tmp/tmpXKFgpx/php-monolog_1.23.0-1ubuntu1.debdiff
diff -Nru php-monolog-1.23.0/debian/patches/mongodb_fixes.patch php-monolog-1.23.0/debian/patches/mongodb_fixes.patch
--- php-monolog-1.23.0/debian/patches/mongodb_fixes.patch	1969-12-31 16:00:00.000000000 -0800
+++ php-monolog-1.23.0/debian/patches/mongodb_fixes.patch	2018-02-12 21:09:52.000000000 -0800
@@ -0,0 +1,207 @@
+Description: Multiple upstream MongoDB handler changes
+Author: Nishanth Aravamudan <nish.aravamudan at canonical.com>
+Origin: upstream, https://github.com/Seldaek/monolog/commit/ad37c8e6638d6d21cf4deaca1aafb8c4a29a6d1b.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/f6a9fdbb2c9ad9ef7f26269a1edb1de1c3b6d3cc.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/d860b763cb0419930e9bce71cec7408f215d5a6d.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/aa6ab660bdb32f4568514ad8ed0167b86a57809b.patch
+Forwarded: Will be done by Nishanth Aravamudan
+Last-Update: 2018-02-13
+
+--- a/composer.json
++++ b/composer.json
+@@ -38,8 +38,8 @@
+         "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
+         "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
+         "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+-        "ext-mongo": "Allow sending log messages to a MongoDB server",
+-        "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
++        "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
++        "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
+         "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
+         "rollbar/rollbar": "Allow sending log messages to Rollbar",
+         "php-console/php-console": "Allow sending log messages to Google Chrome"
+--- a/src/Monolog/Handler/MongoDBHandler.php
++++ b/src/Monolog/Handler/MongoDBHandler.php
+@@ -11,41 +11,66 @@
+ 
+ namespace Monolog\Handler;
+ 
++use MongoDB\Driver\BulkWrite;
++use MongoDB\Driver\Manager;
++use MongoDB\Client;
+ use Monolog\Logger;
+ use Monolog\Formatter\NormalizerFormatter;
+ 
+ /**
+  * Logs to a MongoDB database.
+  *
+- * usage example:
++ * Usage example:
+  *
+- *   $log = new Logger('application');
+- *   $mongodb = new MongoDBHandler(new \Mongo("mongodb://localhost:27017"), "logs", "prod");
++ *   $log = new \Monolog\Logger('application');
++ *   $client = new \MongoDB\Client('mongodb://localhost:27017');
++ *   $mongodb = new \Monolog\Handler\MongoDBHandler($client, 'logs', 'prod');
+  *   $log->pushHandler($mongodb);
+  *
+- * @author Thomas Tourlourat <thomas at tourlourat.com>
++ * The above examples uses the MongoDB PHP library's client class; however, the
++ * MongoDB\Driver\Manager class from ext-mongodb is also supported.
+  */
+ class MongoDBHandler extends AbstractProcessingHandler
+ {
+-    protected $mongoCollection;
++    private $collection;
++    private $manager;
++    private $namespace;
+ 
+-    public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
++    /**
++     * Constructor.
++     *
++     * @param Client|Manager $mongodb    MongoDB library or driver client
++     * @param string         $database   Database name
++     * @param string         $collection Collection name
++     * @param int            $level      The minimum logging level at which this handler will be triggered
++     * @param Boolean        $bubble     Whether the messages that are handled can bubble up the stack or not
++     */
++    public function __construct($mongodb, $database, $collection, $level = Logger::DEBUG, $bubble = true)
+     {
+-        if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) {
+-            throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required');
++        if (!($mongodb instanceof Client || $mongodb instanceof Manager)) {
++            throw new \InvalidArgumentException('MongoDB\Client or MongoDB\Driver\Manager instance required');
+         }
+ 
+-        $this->mongoCollection = $mongo->selectCollection($database, $collection);
++        if ($mongodb instanceof Client) {
++            $this->collection = $mongodb->selectCollection($database, $collection);
++        } else {
++            $this->manager = $mongodb;
++            $this->namespace = $database . '.' . $collection;
++        }
+ 
+         parent::__construct($level, $bubble);
+     }
+ 
+     protected function write(array $record)
+     {
+-        if ($this->mongoCollection instanceof \MongoDB\Collection) {
+-            $this->mongoCollection->insertOne($record["formatted"]);
+-        } else {
+-            $this->mongoCollection->save($record["formatted"]);
++        if (isset($this->collection)) {
++            $this->collection->insertOne($record['formatted']);
++        }
++
++        if (isset($this->manager, $this->namespace)) {
++            $bulk = new BulkWrite;
++            $bulk->insert($record["formatted"]);
++            $this->manager->executeBulkWrite($this->namespace, $bulk);
+         }
+     }
+ 
+@@ -54,6 +79,6 @@
+      */
+     protected function getDefaultFormatter()
+     {
+-        return new NormalizerFormatter();
++        return new NormalizerFormatter;
+     }
+ }
+--- a/tests/Monolog/Handler/MongoDBHandlerTest.php
++++ b/tests/Monolog/Handler/MongoDBHandlerTest.php
+@@ -11,8 +11,9 @@
+ 
+ namespace Monolog\Handler;
+ 
++use MongoDB\Driver\Manager;
+ use Monolog\TestCase;
+-use Monolog\Logger;
++use Monolog\Formatter\NormalizerFormatter;
+ 
+ class MongoDBHandlerTest extends TestCase
+ {
+@@ -21,45 +22,57 @@
+      */
+     public function testConstructorShouldThrowExceptionForInvalidMongo()
+     {
+-        new MongoDBHandler(new \stdClass(), 'DB', 'Collection');
++        new MongoDBHandler(new \stdClass, 'db', 'collection');
+     }
+ 
+-    public function testHandle()
++    public function testHandleWithLibraryClient()
+     {
+-        $mongo = $this->getMock('Mongo', array('selectCollection'), array(), '', false);
+-        $collection = $this->getMock('stdClass', array('save'));
++        if (!(class_exists('MongoDB\Client'))) {
++            $this->markTestSkipped('mongodb/mongodb not installed');
++        }
++
++        $mongodb = $this->getMockBuilder('MongoDB\Client')
++            ->disableOriginalConstructor()
++            ->getMock();
++
++        $collection = $this->getMockBuilder('MongoDB\Collection')
++            ->disableOriginalConstructor()
++            ->getMock();
+ 
+-        $mongo->expects($this->once())
++        $mongodb->expects($this->once())
+             ->method('selectCollection')
+-            ->with('DB', 'Collection')
++            ->with('db', 'collection')
+             ->will($this->returnValue($collection));
+ 
+-        $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+-
+-        $expected = array(
+-            'message' => 'test',
+-            'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34),
+-            'level' => Logger::WARNING,
+-            'level_name' => 'WARNING',
+-            'channel' => 'test',
+-            'datetime' => $record['datetime']->format('Y-m-d H:i:s'),
+-            'extra' => array(),
+-        );
++        $record = $this->getRecord();
++        $expected = $record;
++        $expected['datetime'] = $record['datetime']->format(NormalizerFormatter::SIMPLE_DATE);
+ 
+         $collection->expects($this->once())
+-            ->method('save')
++            ->method('insertOne')
+             ->with($expected);
+ 
+-        $handler = new MongoDBHandler($mongo, 'DB', 'Collection');
++        $handler = new MongoDBHandler($mongodb, 'db', 'collection');
+         $handler->handle($record);
+     }
+-}
+ 
+-if (!class_exists('Mongo')) {
+-    class Mongo
++    public function testHandleWithDriverManager()
+     {
+-        public function selectCollection()
+-        {
++        if (!(class_exists('MongoDB\Driver\Manager'))) {
++            $this->markTestSkipped('ext-mongodb not installed');
++        }
++
++        /* This can become a unit test once ManagerInterface can be mocked.
++         * See: https://jira.mongodb.org/browse/PHPC-378
++         */
++        $mongodb = new Manager('mongodb://localhost:27017');
++        $handler = new MongoDBHandler($mongodb, 'test', 'monolog');
++        $record = $this->getRecord();
++
++        try {
++            $handler->handle($record);
++        } catch (\RuntimeException $e) {
++            $this->markTestSkipped('Could not connect to MongoDB server on mongodb://localhost:27017');
+         }
+     }
+ }
diff -Nru php-monolog-1.23.0/debian/patches/phpunit6_compatibility_changes.patch php-monolog-1.23.0/debian/patches/phpunit6_compatibility_changes.patch
--- php-monolog-1.23.0/debian/patches/phpunit6_compatibility_changes.patch	1969-12-31 16:00:00.000000000 -0800
+++ php-monolog-1.23.0/debian/patches/phpunit6_compatibility_changes.patch	2018-02-12 21:09:52.000000000 -0800
@@ -0,0 +1,905 @@
+Description: PHPUnit 6 is not backwards compatible in various ways
+ Namespaced classes, and class implementations, require code changes.
+ Additional to the mentioned commits, backport some dropped tests from
+ https://github.com/Seldaek/monolog/commit/3d30ba5ecc301dc0e7d61480c7a163cfcf1458fc#diff-8dc60cc2fc33def0cd3d16476940a1e2.
+ The bug mentioned below is still open at this time, but for now I've
+ disabled the predis tests.
+Origin: upstream, https://github.com/Seldaek/monolog/commit/c6a9f28e24ee199669f76fd1ae1db2add0b7cf2d.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/28742b656ffe7c79d30925711ade009eb7c53cde.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/85250d3c72b4609ddde31ab3111fcf6c2b99d715.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/ca4ffa68f63081523515947236968a511ebc0fa4.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/3c74c7a8d2435344539bba0fd7089e7d3f54df2b.patch
+Origin: upstream, https://github.com/Seldaek/monolog/commit/21dde4dedbbbefe3f8055ce5c1d4aaf8516d9ec6#diff-31ab4213670e22840e43c6c5993ff342
+Origin: upstream, https://github.com/Seldaek/monolog/commit/b21b465cca4647d4ecae64795a8d6be6296fb15c.patch
+Bug: https://github.com/Seldaek/monolog/issues/1114
+Bug-Ubuntu: https://launchpad.net/bugs/1749001
+Last-Update: 2018-02-13
+
+--- a/composer.json
++++ b/composer.json
+@@ -17,7 +17,7 @@
+         "psr/log": "~1.0"
+     },
+     "require-dev": {
+-        "phpunit/phpunit": "~4.5",
++        "phpunit/phpunit": "^5.7",
+         "graylog2/gelf-php": "~1.0",
+         "sentry/sentry": "^0.13",
+         "ruflin/elastica": ">=0.90 <3.0",
+@@ -27,7 +27,8 @@
+         "swiftmailer/swiftmailer": "^5.3|^6.0",
+         "php-console/php-console": "^3.1.3",
+         "phpunit/phpunit-mock-objects": "2.3.0",
+-        "jakub-onderka/php-parallel-lint": "0.9"
++        "jakub-onderka/php-parallel-lint": "^0.9",
++        "predis/predis": "^1.1"
+     },
+     "_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis",
+     "suggest": {
+--- a/tests/Monolog/ErrorHandlerTest.php
++++ b/tests/Monolog/ErrorHandlerTest.php
+@@ -13,7 +13,7 @@
+ 
+ use Monolog\Handler\TestHandler;
+ 
+-class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
++class ErrorHandlerTest extends \PHPUnit\Framework\TestCase
+ {
+     public function testHandleError()
+     {
+--- a/tests/Monolog/Formatter/ChromePHPFormatterTest.php
++++ b/tests/Monolog/Formatter/ChromePHPFormatterTest.php
+@@ -13,7 +13,7 @@
+ 
+ use Monolog\Logger;
+ 
+-class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
++class ChromePHPFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     /**
+      * @covers Monolog\Formatter\ChromePHPFormatter::format
+--- a/tests/Monolog/Formatter/ElasticaFormatterTest.php
++++ b/tests/Monolog/Formatter/ElasticaFormatterTest.php
+@@ -13,7 +13,7 @@
+ 
+ use Monolog\Logger;
+ 
+-class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase
++class ElasticaFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     public function setUp()
+     {
+--- a/tests/Monolog/Formatter/GelfMessageFormatterTest.php
++++ b/tests/Monolog/Formatter/GelfMessageFormatterTest.php
+@@ -13,7 +13,7 @@
+ 
+ use Monolog\Logger;
+ 
+-class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
++class GelfMessageFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     public function setUp()
+     {
+--- a/tests/Monolog/Formatter/LineFormatterTest.php
++++ b/tests/Monolog/Formatter/LineFormatterTest.php
+@@ -14,7 +14,7 @@
+ /**
+  * @covers Monolog\Formatter\LineFormatter
+  */
+-class LineFormatterTest extends \PHPUnit_Framework_TestCase
++class LineFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     public function testDefFormatWithString()
+     {
+--- a/tests/Monolog/Formatter/LogstashFormatterTest.php
++++ b/tests/Monolog/Formatter/LogstashFormatterTest.php
+@@ -13,11 +13,11 @@
+ 
+ use Monolog\Logger;
+ 
+-class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
++class LogstashFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     public function tearDown()
+     {
+-        \PHPUnit_Framework_Error_Warning::$enabled = true;
++        \PHPUnit\Framework\Error\Warning::$enabled = true;
+ 
+         return parent::tearDown();
+     }
+@@ -298,7 +298,7 @@
+     {
+         if (version_compare(PHP_VERSION, '5.5.0', '<')) {
+             // Ignore the warning that will be emitted by PHP <5.5.0
+-            \PHPUnit_Framework_Error_Warning::$enabled = false;
++            \PHPUnit\Framework\Error\Warning::$enabled = false;
+         }
+         $formatter = new LogstashFormatter('test', 'hostname');
+         $record = array(
+--- a/tests/Monolog/Formatter/MongoDBFormatterTest.php
++++ b/tests/Monolog/Formatter/MongoDBFormatterTest.php
+@@ -16,7 +16,7 @@
+ /**
+  * @author Florian Plattner <me at florianplattner.de>
+  */
+-class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
++class MongoDBFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     public function setUp()
+     {
+--- a/tests/Monolog/Formatter/NormalizerFormatterTest.php
++++ b/tests/Monolog/Formatter/NormalizerFormatterTest.php
+@@ -14,11 +14,11 @@
+ /**
+  * @covers Monolog\Formatter\NormalizerFormatter
+  */
+-class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
++class NormalizerFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     public function tearDown()
+     {
+-        \PHPUnit_Framework_Error_Warning::$enabled = true;
++        \PHPUnit\Framework\Error\Warning::$enabled = true;
+ 
+         return parent::tearDown();
+     }
+@@ -115,7 +115,7 @@
+     public function testFormatToStringExceptionHandle()
+     {
+         $formatter = new NormalizerFormatter('Y-m-d');
+-        $this->setExpectedException('RuntimeException', 'Could not convert to string');
++        $this->expectException('RuntimeException', 'Could not convert to string');
+         $formatter->format(array(
+             'myObject' => new TestToStringError(),
+         ));
+@@ -242,7 +242,7 @@
+     {
+         if (version_compare(PHP_VERSION, '5.5.0', '<')) {
+             // Ignore the warning that will be emitted by PHP <5.5.0
+-            \PHPUnit_Framework_Error_Warning::$enabled = false;
++            \PHPUnit\Framework\Error\Warning::$enabled = false;
+         }
+         $formatter = new NormalizerFormatter();
+         $reflMethod = new \ReflectionMethod($formatter, 'toJson');
+@@ -261,7 +261,7 @@
+     {
+         if (version_compare(PHP_VERSION, '5.5.0', '<')) {
+             // Ignore the warning that will be emitted by PHP <5.5.0
+-            \PHPUnit_Framework_Error_Warning::$enabled = false;
++            \PHPUnit\Framework\Error\Warning::$enabled = false;
+         }
+         $formatter = new NormalizerFormatter();
+         $reflMethod = new \ReflectionMethod($formatter, 'toJson');
+@@ -321,7 +321,7 @@
+         $reflMethod = new \ReflectionMethod($formatter, 'handleJsonError');
+         $reflMethod->setAccessible(true);
+ 
+-        $this->setExpectedException('RuntimeException', $msg);
++        $this->expectException('RuntimeException', $msg);
+         $reflMethod->invoke($formatter, $code, 'faked');
+     }
+ 
+--- a/tests/Monolog/Formatter/ScalarFormatterTest.php
++++ b/tests/Monolog/Formatter/ScalarFormatterTest.php
+@@ -11,7 +11,7 @@
+ 
+ namespace Monolog\Formatter;
+ 
+-class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
++class ScalarFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     private $formatter;
+ 
+--- a/tests/Monolog/Formatter/WildfireFormatterTest.php
++++ b/tests/Monolog/Formatter/WildfireFormatterTest.php
+@@ -13,7 +13,7 @@
+ 
+ use Monolog\Logger;
+ 
+-class WildfireFormatterTest extends \PHPUnit_Framework_TestCase
++class WildfireFormatterTest extends \PHPUnit\Framework\TestCase
+ {
+     /**
+      * @covers Monolog\Formatter\WildfireFormatter::format
+--- a/tests/Monolog/Handler/AmqpHandlerTest.php
++++ b/tests/Monolog/Handler/AmqpHandlerTest.php
+@@ -33,11 +33,11 @@
+ 
+         $messages = array();
+ 
+-        $exchange = $this->getMock('AMQPExchange', array('publish', 'setName'), array(), '', false);
+-        $exchange->expects($this->once())
+-            ->method('setName')
+-            ->with('log')
+-        ;
++        $exchange = $this->getMockBuilder('AMQPExchange')
++            ->setMethods(['publish', 'setName'])
++            ->disableOriginalConstructor()
++            ->getMock();
++
+         $exchange->expects($this->any())
+             ->method('publish')
+             ->will($this->returnCallback(function ($message, $routing_key, $flags = 0, $attributes = array()) use (&$messages) {
+@@ -85,7 +85,10 @@
+ 
+         $messages = array();
+ 
+-        $exchange = $this->getMock('PhpAmqpLib\Channel\AMQPChannel', array('basic_publish', '__destruct'), array(), '', false);
++        $exchange = $this->getMockBuilder('PhpAmqpLib\Channel\AMQPChannel')
++            ->setMethods(['basic_publish', '__destruct'])
++            ->disableOriginalConstructor()
++            ->getMock();
+ 
+         $exchange->expects($this->any())
+             ->method('basic_publish')
+--- a/tests/Monolog/Handler/DynamoDbHandlerTest.php
++++ b/tests/Monolog/Handler/DynamoDbHandlerTest.php
+@@ -25,7 +25,8 @@
+ 
+         $this->client = $this->getMockBuilder('Aws\DynamoDb\DynamoDbClient')
+             ->setMethods(array('formatAttributes', '__call'))
+-            ->disableOriginalConstructor()->getMock();
++            ->disableOriginalConstructor()
++            ->getMock();
+     }
+ 
+     public function testConstruct()
+@@ -47,7 +48,7 @@
+     public function testHandle()
+     {
+         $record = $this->getRecord();
+-        $formatter = $this->getMock('Monolog\Formatter\FormatterInterface');
++        $formatter = $this->createMock('Monolog\Formatter\FormatterInterface');
+         $formatted = array('foo' => 1, 'bar' => 2);
+         $handler = new DynamoDbHandler($this->client, 'foo');
+         $handler->setFormatter($formatter);
+--- a/tests/Monolog/Handler/ElasticSearchHandlerTest.php
++++ b/tests/Monolog/Handler/ElasticSearchHandlerTest.php
+@@ -134,7 +134,7 @@
+         $handler = new ElasticSearchHandler($client, $handlerOpts);
+ 
+         if ($expectedError) {
+-            $this->setExpectedException($expectedError[0], $expectedError[1]);
++            $this->expectException($expectedError[0], $expectedError[1]);
+             $handler->handle($this->getRecord());
+         } else {
+             $this->assertFalse($handler->handle($this->getRecord()));
+--- a/tests/Monolog/Handler/FlowdockHandlerTest.php
++++ b/tests/Monolog/Handler/FlowdockHandlerTest.php
+@@ -63,11 +63,10 @@
+     {
+         $constructorArgs = array($token, Logger::DEBUG);
+         $this->res = fopen('php://memory', 'a');
+-        $this->handler = $this->getMock(
+-            '\Monolog\Handler\FlowdockHandler',
+-            array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+-            $constructorArgs
+-        );
++        $this->handler = $this->getMockBuilder('\Monolog\Handler\FlowdockHandler')
++            ->setConstructorArgs($constructorArgs)
++            ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
++            ->getMock();
+ 
+         $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+         $reflectionProperty->setAccessible(true);
+--- a/tests/Monolog/Handler/GelfHandlerTest.php
++++ b/tests/Monolog/Handler/GelfHandlerTest.php
+@@ -43,7 +43,10 @@
+ 
+     protected function getMessagePublisher()
+     {
+-        return $this->getMock('Gelf\Publisher', array('publish'), array(), '', false);
++        return $this->getMockBuilder('Gelf\Publisher')
++            ->setMethods(['publish'])
++            ->disableOriginalConstructor()
++            ->getMock();
+     }
+ 
+     public function testDebug()
+--- a/tests/Monolog/Handler/HandlerWrapperTest.php
++++ b/tests/Monolog/Handler/HandlerWrapperTest.php
+@@ -28,7 +28,7 @@
+     public function setUp()
+     {
+         parent::setUp();
+-        $this->handler = $this->getMock('Monolog\\Handler\\HandlerInterface');
++        $this->handler = $this->createMock('Monolog\\Handler\\HandlerInterface');
+         $this->wrapper = new HandlerWrapper($this->handler);
+     }
+ 
+@@ -87,44 +87,4 @@
+ 
+         $this->assertEquals($result, $this->wrapper->handleBatch($records));
+     }
+-
+-    public function testPushProcessor()
+-    {
+-        $processor = function () {};
+-        $this->handler->expects($this->once())
+-            ->method('pushProcessor')
+-            ->with($processor);
+-
+-        $this->assertEquals($this->wrapper, $this->wrapper->pushProcessor($processor));
+-    }
+-
+-    public function testPopProcessor()
+-    {
+-        $processor = function () {};
+-        $this->handler->expects($this->once())
+-            ->method('popProcessor')
+-            ->willReturn($processor);
+-
+-        $this->assertEquals($processor, $this->wrapper->popProcessor());
+-    }
+-
+-    public function testSetFormatter()
+-    {
+-        $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+-        $this->handler->expects($this->once())
+-            ->method('setFormatter')
+-            ->with($formatter);
+-
+-        $this->assertEquals($this->wrapper, $this->wrapper->setFormatter($formatter));
+-    }
+-
+-    public function testGetFormatter()
+-    {
+-        $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+-        $this->handler->expects($this->once())
+-            ->method('getFormatter')
+-            ->willReturn($formatter);
+-
+-        $this->assertEquals($formatter, $this->wrapper->getFormatter());
+-    }
+ }
+--- a/tests/Monolog/Handler/HipChatHandlerTest.php
++++ b/tests/Monolog/Handler/HipChatHandlerTest.php
+@@ -240,11 +240,10 @@
+     {
+         $constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host, $version);
+         $this->res = fopen('php://memory', 'a');
+-        $this->handler = $this->getMock(
+-            '\Monolog\Handler\HipChatHandler',
+-            array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+-            $constructorArgs
+-        );
++        $this->handler = $this->getMockBuilder('\Monolog\Handler\HipChatHandler')
++            ->setConstructorArgs($constructorArgs)
++            ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
++            ->getMock();
+ 
+         $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+         $reflectionProperty->setAccessible(true);
+--- a/tests/Monolog/Handler/LogEntriesHandlerTest.php
++++ b/tests/Monolog/Handler/LogEntriesHandlerTest.php
+@@ -61,11 +61,10 @@
+         $useSSL = extension_loaded('openssl');
+         $args = array('testToken', $useSSL, Logger::DEBUG, true);
+         $this->res = fopen('php://memory', 'a');
+-        $this->handler = $this->getMock(
+-            '\Monolog\Handler\LogEntriesHandler',
+-            array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+-            $args
+-        );
++        $this->handler = $this->getMockBuilder('\Monolog\Handler\LogEntriesHandler')
++            ->setConstructorArgs($args)
++            ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
++            ->getMock();
+ 
+         $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+         $reflectionProperty->setAccessible(true);
+--- a/tests/Monolog/Handler/MailHandlerTest.php
++++ b/tests/Monolog/Handler/MailHandlerTest.php
+@@ -21,11 +21,11 @@
+      */
+     public function testHandleBatch()
+     {
+-        $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
++        $formatter = $this->createMock('Monolog\\Formatter\\FormatterInterface');
+         $formatter->expects($this->once())
+             ->method('formatBatch'); // Each record is formatted
+ 
+-        $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
++        $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler', [], '', true, true, true, ['send', 'write']);
+         $handler->expects($this->once())
+             ->method('send');
+         $handler->expects($this->never())
+--- a/tests/Monolog/Handler/PsrHandlerTest.php
++++ b/tests/Monolog/Handler/PsrHandlerTest.php
+@@ -39,7 +39,7 @@
+         $message = 'Hello, world! ' . $level;
+         $context = array('foo' => 'bar', 'level' => $level);
+ 
+-        $psrLogger = $this->getMock('Psr\Log\NullLogger');
++        $psrLogger = $this->createMock('Psr\Log\NullLogger');
+         $psrLogger->expects($this->once())
+             ->method('log')
+             ->with(strtolower($levelName), $message, $context);
+--- a/tests/Monolog/Handler/PushoverHandlerTest.php
++++ b/tests/Monolog/Handler/PushoverHandlerTest.php
+@@ -116,11 +116,10 @@
+     {
+         $constructorArgs = array($token, $user, $title);
+         $this->res = fopen('php://memory', 'a');
+-        $this->handler = $this->getMock(
+-            '\Monolog\Handler\PushoverHandler',
+-            array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+-            $constructorArgs
+-        );
++        $this->handler = $this->getMockBuilder('\Monolog\Handler\PushoverHandler')
++            ->setConstructorArgs($constructorArgs)
++            ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
++            ->getMock();
+ 
+         $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+         $reflectionProperty->setAccessible(true);
+--- a/tests/Monolog/Handler/RavenHandlerTest.php
++++ b/tests/Monolog/Handler/RavenHandlerTest.php
+@@ -169,10 +169,10 @@
+         $records[] = $this->getRecord(Logger::WARNING, 'warning');
+         $records[] = $this->getRecord(Logger::WARNING, 'warning');
+ 
+-        $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
++        $logFormatter = $this->createMock('Monolog\\Formatter\\FormatterInterface');
+         $logFormatter->expects($this->once())->method('formatBatch');
+ 
+-        $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
++        $formatter = $this->createMock('Monolog\\Formatter\\FormatterInterface');
+         $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) {
+             return $record['level'] == 400;
+         }));
+@@ -191,7 +191,10 @@
+             $this->getRecord(Logger::INFO, 'information'),
+         );
+ 
+-        $handler = $this->getMock('Monolog\Handler\RavenHandler', null, array($this->getRavenClient()));
++        $handler = $this->getMockBuilder('Monolog\Handler\RavenHandler')
++            ->setMethods(['handle'])
++            ->setConstructorArgs([$this->getRavenClient()])
++            ->getMock();
+         $handler->expects($this->never())->method('handle');
+         $handler->setLevel(Logger::ERROR);
+         $handler->handleBatch($records);
+--- a/tests/Monolog/Handler/RedisHandlerTest.php
++++ b/tests/Monolog/Handler/RedisHandlerTest.php
+@@ -27,19 +27,31 @@
+ 
+     public function testConstructorShouldWorkWithPredis()
+     {
+-        $redis = $this->getMock('Predis\Client');
++        if (!class_exists('Predis')) {
++            $this->markTestSkipped('The predis ext is required to run this test');
++        }
++
++        $redis = $this->createMock('Predis\Client');
+         $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key'));
+     }
+ 
+     public function testConstructorShouldWorkWithRedis()
+     {
+-        $redis = $this->getMock('Redis');
++        if (!class_exists('Redis')) {
++            $this->markTestSkipped('The redis ext is required to run this test');
++        }
++
++        $redis = $this->createMock('Redis');
+         $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key'));
+     }
+ 
+     public function testPredisHandle()
+     {
+-        $redis = $this->getMock('Predis\Client', array('rpush'));
++        if (!class_exists('Predis')) {
++            $this->markTestSkipped('The predis ext is required to run this test');
++        }
++
++        $redis = $this->createPartialMock('Predis\Client', array('rpush'));
+ 
+         // Predis\Client uses rpush
+         $redis->expects($this->once())
+@@ -55,7 +67,11 @@
+ 
+     public function testRedisHandle()
+     {
+-        $redis = $this->getMock('Redis', array('rpush'));
++        if (!class_exists('Redis')) {
++            $this->markTestSkipped('The redis ext is required to run this test');
++        }
++
++        $redis = $this->createPartialMock('Redis', array('rpush'));
+ 
+         // Redis uses rPush
+         $redis->expects($this->once())
+@@ -71,7 +87,11 @@
+ 
+     public function testRedisHandleCapped()
+     {
+-        $redis = $this->getMock('Redis', array('multi', 'rpush', 'ltrim', 'exec'));
++        if (!class_exists('Redis')) {
++            $this->markTestSkipped('The redis ext is required to run this test');
++        }
++
++        $redis = $this->createPartialMock('Redis', array('multi', 'rpush', 'ltrim', 'exec'));
+ 
+         // Redis uses multi
+         $redis->expects($this->once())
+@@ -99,9 +119,13 @@
+ 
+     public function testPredisHandleCapped()
+     {
+-        $redis = $this->getMock('Predis\Client', array('transaction'));
++        if (!class_exists('Predis')) {
++            $this->markTestSkipped('The predis ext is required to run this test');
++        }
++
++        $redis = $this->createPartialMock('Predis\Client', array('transaction'));
+ 
+-        $redisTransaction = $this->getMock('Predis\Client', array('rpush', 'ltrim'));
++        $redisTransaction = $this->createPartialMock('Predis\Client', array('rpush', 'ltrim'));
+ 
+         $redisTransaction->expects($this->once())
+             ->method('rpush')
+--- a/tests/Monolog/Handler/SlackHandlerTest.php
++++ b/tests/Monolog/Handler/SlackHandlerTest.php
+@@ -130,11 +130,10 @@
+     {
+         $constructorArgs = array($token, $channel, $username, $useAttachment, $iconEmoji, Logger::DEBUG, true, $useShortAttachment, $includeExtra);
+         $this->res = fopen('php://memory', 'a');
+-        $this->handler = $this->getMock(
+-            '\Monolog\Handler\SlackHandler',
+-            array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+-            $constructorArgs
+-        );
++        $this->handler = $this->getMockBuilder('\Monolog\Handler\SlackHandler')
++            ->setConstructorArgs($constructorArgs)
++            ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
++            ->getMock();
+ 
+         $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+         $reflectionProperty->setAccessible(true);
+--- a/tests/Monolog/Handler/SocketHandlerTest.php
++++ b/tests/Monolog/Handler/SocketHandlerTest.php
+@@ -282,9 +282,10 @@
+ 
+         $finalMethods = array_merge($defaultMethods, $newMethods);
+ 
+-        $this->handler = $this->getMock(
+-            '\Monolog\Handler\SocketHandler', $finalMethods, array('localhost:1234')
+-        );
++        $this->handler = $this->getMockBuilder('\Monolog\Handler\SocketHandler')
++            ->setMethods($finalMethods)
++            ->setConstructorArgs(['localhost:1234'])
++            ->getMock();
+ 
+         if (!in_array('fsockopen', $methods)) {
+             $this->handler->expects($this->any())
+--- a/tests/Monolog/Handler/SyslogHandlerTest.php
++++ b/tests/Monolog/Handler/SyslogHandlerTest.php
+@@ -13,7 +13,7 @@
+ 
+ use Monolog\Logger;
+ 
+-class SyslogHandlerTest extends \PHPUnit_Framework_TestCase
++class SyslogHandlerTest extends \PHPUnit\Framework\TestCase
+ {
+     /**
+      * @covers Monolog\Handler\SyslogHandler::__construct
+@@ -38,7 +38,7 @@
+      */
+     public function testConstructInvalidFacility()
+     {
+-        $this->setExpectedException('UnexpectedValueException');
++        $this->expectException('UnexpectedValueException');
+         $handler = new SyslogHandler('test', 'unknown');
+     }
+ }
+--- a/tests/Monolog/Handler/SyslogUdpHandlerTest.php
++++ b/tests/Monolog/Handler/SyslogUdpHandlerTest.php
+@@ -42,7 +42,10 @@
+ 
+         $handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());
+ 
+-        $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
++        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
++            ->setMethods(['write'])
++            ->setConstructorArgs(['lol', 'lol'])
++            ->getMock();
+         $socket->expects($this->at(0))
+             ->method('write')
+             ->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ");
+@@ -60,7 +63,10 @@
+         $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv");
+         $handler->setFormatter($this->getIdentityFormatter());
+ 
+-        $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
++        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
++            ->setMethods(['write'])
++            ->setConstructorArgs(['lol', 'lol'])
++            ->getMock();
+         $socket->expects($this->never())
+             ->method('write');
+ 
+--- a/tests/Monolog/Handler/UdpSocketTest.php
++++ b/tests/Monolog/Handler/UdpSocketTest.php
+@@ -21,7 +21,10 @@
+ {
+     public function testWeDoNotTruncateShortMessages()
+     {
+-        $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
++        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
++            ->setMethods(['send'])
++            ->setConstructorArgs(['lol', 'lol'])
++            ->getMock();
+ 
+         $socket->expects($this->at(0))
+             ->method('send')
+@@ -32,7 +35,10 @@
+ 
+     public function testLongMessagesAreTruncated()
+     {
+-        $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
++        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
++            ->setMethods(['send'])
++            ->setConstructorArgs(['lol', 'lol'])
++            ->getMock();
+ 
+         $truncatedString = str_repeat("derp", 16254).'d';
+ 
+--- a/tests/Monolog/LoggerTest.php
++++ b/tests/Monolog/LoggerTest.php
+@@ -14,7 +14,7 @@
+ use Monolog\Processor\WebProcessor;
+ use Monolog\Handler\TestHandler;
+ 
+-class LoggerTest extends \PHPUnit_Framework_TestCase
++class LoggerTest extends \PHPUnit\Framework\TestCase
+ {
+     /**
+      * @covers Monolog\Logger::getName
+@@ -90,10 +90,11 @@
+     {
+         $logger = new Logger(__METHOD__);
+ 
+-        $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'));
+-        $handler->expects($this->once())
+-            ->method('handle');
+-        $logger->pushHandler($handler);
++        $handler = $this->prophesize('Monolog\Handler\NullHandler');
++        $handler->handle(\Prophecy\Argument::any())->shouldBeCalled();
++        $handler->isHandling(['level' => 300])->willReturn(true);
++
++        $logger->pushHandler($handler->reveal());
+ 
+         $this->assertTrue($logger->addWarning('test'));
+     }
+@@ -105,10 +106,11 @@
+     {
+         $logger = new Logger(__METHOD__);
+ 
+-        $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'), array(Logger::ERROR));
+-        $handler->expects($this->never())
+-            ->method('handle');
+-        $logger->pushHandler($handler);
++        $handler = $this->prophesize('Monolog\Handler\NullHandler');
++        $handler->handle()->shouldNotBeCalled();
++        $handler->isHandling(['level' => 300])->willReturn(false);
++
++        $logger->pushHandler($handler->reveal());
+ 
+         $this->assertFalse($logger->addWarning('test'));
+     }
+@@ -230,7 +232,7 @@
+     public function testProcessorsAreCalledOnlyOnce()
+     {
+         $logger = new Logger(__METHOD__);
+-        $handler = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler->expects($this->any())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+@@ -261,7 +263,7 @@
+     public function testProcessorsNotCalledWhenNotHandled()
+     {
+         $logger = new Logger(__METHOD__);
+-        $handler = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler->expects($this->once())
+             ->method('isHandling')
+             ->will($this->returnValue(false))
+@@ -281,7 +283,7 @@
+     {
+         $logger = new Logger(__METHOD__);
+ 
+-        $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler1->expects($this->never())
+             ->method('isHandling')
+             ->will($this->returnValue(false))
+@@ -292,7 +294,7 @@
+         ;
+         $logger->pushHandler($handler1);
+ 
+-        $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler2->expects($this->once())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+@@ -303,7 +305,7 @@
+         ;
+         $logger->pushHandler($handler2);
+ 
+-        $handler3 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler3 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler3->expects($this->once())
+             ->method('isHandling')
+             ->will($this->returnValue(false))
+@@ -321,7 +323,7 @@
+      */
+     public function testHandlersNotCalledBeforeFirstHandlingWithAssocArray()
+     {
+-        $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler1->expects($this->never())
+             ->method('isHandling')
+             ->will($this->returnValue(false))
+@@ -331,7 +333,7 @@
+             ->will($this->returnValue(false))
+         ;
+ 
+-        $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler2->expects($this->once())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+@@ -341,7 +343,7 @@
+             ->will($this->returnValue(false))
+         ;
+ 
+-        $handler3 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler3 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler3->expects($this->once())
+             ->method('isHandling')
+             ->will($this->returnValue(false))
+@@ -362,7 +364,7 @@
+     {
+         $logger = new Logger(__METHOD__);
+ 
+-        $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler1->expects($this->any())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+@@ -373,7 +375,7 @@
+         ;
+         $logger->pushHandler($handler1);
+ 
+-        $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler2->expects($this->any())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+@@ -394,7 +396,7 @@
+     {
+         $logger = new Logger(__METHOD__);
+ 
+-        $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler1->expects($this->any())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+@@ -404,7 +406,7 @@
+         ;
+         $logger->pushHandler($handler1);
+ 
+-        $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler2->expects($this->any())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+@@ -425,7 +427,7 @@
+     {
+         $logger = new Logger(__METHOD__);
+ 
+-        $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler1->expects($this->any())
+             ->method('isHandling')
+             ->will($this->returnValue(false))
+@@ -434,7 +436,7 @@
+         $logger->pushHandler($handler1);
+         $this->assertFalse($logger->isHandling(Logger::DEBUG));
+ 
+-        $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
++        $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
+         $handler2->expects($this->any())
+             ->method('isHandling')
+             ->will($this->returnValue(true))
+--- a/tests/Monolog/Processor/PsrLogMessageProcessorTest.php
++++ b/tests/Monolog/Processor/PsrLogMessageProcessorTest.php
+@@ -11,7 +11,7 @@
+ 
+ namespace Monolog\Processor;
+ 
+-class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase
++class PsrLogMessageProcessorTest extends \PHPUnit\Framework\TestCase
+ {
+     /**
+      * @dataProvider getPairs
+--- a/tests/Monolog/RegistryTest.php
++++ b/tests/Monolog/RegistryTest.php
+@@ -11,7 +11,7 @@
+ 
+ namespace Monolog;
+ 
+-class RegistryTest extends \PHPUnit_Framework_TestCase
++class RegistryTest extends \PHPUnit\Framework\TestCase
+ {
+     protected function setUp()
+     {
+@@ -68,7 +68,7 @@
+         Registry::addLogger(new Logger('test1'), 'log');
+         Registry::clear();
+ 
+-        $this->setExpectedException('\InvalidArgumentException');
++        $this->expectException('\InvalidArgumentException');
+         Registry::getInstance('log');
+     }
+ 
+@@ -82,7 +82,7 @@
+         Registry::addLogger($loggerToAdd);
+         Registry::removeLogger($remove);
+ 
+-        $this->setExpectedException('\InvalidArgumentException');
++        $this->expectException('\InvalidArgumentException');
+         Registry::getInstance($loggerToAdd->getName());
+     }
+ 
+--- a/tests/Monolog/TestCase.php
++++ b/tests/Monolog/TestCase.php
+@@ -11,7 +11,7 @@
+ 
+ namespace Monolog;
+ 
+-class TestCase extends \PHPUnit_Framework_TestCase
++class TestCase extends \PHPUnit\Framework\TestCase
+ {
+     /**
+      * @return array Record
+@@ -48,7 +48,7 @@
+      */
+     protected function getIdentityFormatter()
+     {
+-        $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
++        $formatter = $this->createMock('Monolog\\Formatter\\FormatterInterface');
+         $formatter->expects($this->any())
+             ->method('format')
+             ->will($this->returnCallback(function ($record) { return $record['message']; }));
+--- a/src/Monolog/Handler/Slack/SlackRecord.php
++++ b/src/Monolog/Handler/Slack/SlackRecord.php
+@@ -89,7 +89,7 @@
+     {
+         $this->channel = $channel;
+         $this->username = $username;
+-        $this->userIcon = trim($userIcon, ':');
++        $this->userIcon = $userIcon !== null ? trim($userIcon, ':') : null;
+         $this->useAttachment = $useAttachment;
+         $this->useShortAttachment = $useShortAttachment;
+         $this->includeContextAndExtra = $includeContextAndExtra;
+--- a/tests/Monolog/Handler/Slack/SlackRecordTest.php
++++ b/tests/Monolog/Handler/Slack/SlackRecordTest.php
+@@ -172,13 +172,13 @@
+ 
+     public function testTextEqualsFormatterOutput()
+     {
+-        $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
++        $formatter = $this->createMock('Monolog\\Formatter\\FormatterInterface');
+         $formatter
+             ->expects($this->any())
+             ->method('format')
+             ->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; }));
+ 
+-        $formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface');
++        $formatter2 = $this->createMock('Monolog\\Formatter\\FormatterInterface');
+         $formatter2
+             ->expects($this->any())
+             ->method('format')
diff -Nru php-monolog-1.23.0/debian/patches/series php-monolog-1.23.0/debian/patches/series
--- php-monolog-1.23.0/debian/patches/series	2017-08-07 03:41:09.000000000 -0700
+++ php-monolog-1.23.0/debian/patches/series	2018-02-12 21:09:52.000000000 -0800
@@ -1 +1,3 @@
 0001-Drop-Git-test.patch
+phpunit6_compatibility_changes.patch
+mongodb_fixes.patch


-- System Information:
Debian Release: buster/sid
  APT prefers bionic
  APT policy: (500, 'bionic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-25-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- 
Nishanth Aravamudan
Ubuntu Server
Canonical Ltd



More information about the pkg-php-pear mailing list