diff options
Diffstat (limited to 'tests/lib/TestCase.php')
-rw-r--r-- | tests/lib/TestCase.php | 18 |
1 files changed, 18 insertions, 0 deletions
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 @@ -48,6 +48,24 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { 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 * @return bool |