From db710e0b034d6f42a00f7b1188d8ff7399ea1d7a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 13 Sep 2016 16:16:02 +0200 Subject: Make tests work with 4.8 at least --- tests/lib/TestCase.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/lib/TestCase.php') diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index f5d65679c90..0389ef5d46b 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -47,6 +47,24 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { /** @var array */ protected $services = []; + /** + * Wrapper to be forward compatible to phpunit 5.4+ + * + * @param string $originalClassName + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function createMock($originalClassName) { + if (is_callable('parent::createMock')) { + return parent::createMock($originalClassName); + } + + return $this->getMockBuilder($originalClassName) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->getMock(); + } + /** * @param string $name * @param mixed $newService -- cgit v1.2.3