From 01ef6ea2906c3ad2ecb460be3a26261a0444d837 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Sun, 12 Mar 2017 08:48:57 +0100 Subject: [PATCH] support phpunit 5 and 6 We still need 5 to test on old php versions, but travis uses 6 for newer PHP versions (and 5 may break on those). Luckily both versions aren't that far apart, yet. This adds a thin adapter class when running on 6. --- _test/core/DokuWikiTest.php | 24 +++++++++++++++++++++++- _test/phpunit.xml | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php index 08f6e5c97..2e4caefdb 100644 --- a/_test/core/DokuWikiTest.php +++ b/_test/core/DokuWikiTest.php @@ -1,8 +1,30 @@ <?php + + +if(!class_exists('PHPUnit_Framework_TestCase')) { + /** + * phpunit 5/6 compatibility + */ + class PHPUnit_Framework_TestCase extends PHPUnit\Framework\TestCase { + /** + * @param string $class + * @param null|string $message + */ + public function setExpectedException($class, $message=null) { + $this->expectException($class); + if(!is_null($message)) { + $this->expectExceptionMessage($message); + } + } + } +} + + + /** * Helper class to provide basic functionality for tests */ -abstract class DokuWikiTest extends PHPUnit\Framework\TestCase { +abstract class DokuWikiTest extends PHPUnit_Framework_TestCase { /** * tests can override this diff --git a/_test/phpunit.xml b/_test/phpunit.xml index 6e2509749..f4b88be9c 100644 --- a/_test/phpunit.xml +++ b/_test/phpunit.xml @@ -4,6 +4,7 @@ convertNoticesToExceptions="false" colors="true" stderr="true" + backupGlobals="true" > <testsuites> -- GitLab