diff --git a/tests/local_codechecker_testcase.php b/tests/local_codechecker_testcase.php index d9390eaa..e93a0e08 100644 --- a/tests/local_codechecker_testcase.php +++ b/tests/local_codechecker_testcase.php @@ -33,6 +33,19 @@ require_once('PHP/CodeSniffer.php'); } +// Interim classes providing conditional extension, so I can run +// these plugin tests against different Moodle branches that are +// using different phpunit (namespaced or no) clases. +// @codingStandardsIgnoreStart +if (class_exists('PHPUnit_Framework_TestCase')) { + abstract class conditional_PHPUnit_Framework_TestCase extends PHPUnit_Framework_TestCase { + } +} else { + abstract class conditional_PHPUnit_Framework_TestCase extends PHPUnit\Framework\TestCase { + } +} +// @codingStandardsIgnoreEnd + /** * Specialized test case for easy testing of "moodle" CS Sniffs. * @@ -43,7 +56,7 @@ * * Note extension & overriding was impossible because of some "final" stuff. */ -abstract class local_codechecker_testcase extends PHPUnit_Framework_TestCase { +abstract class local_codechecker_testcase extends conditional_PHPUnit_Framework_TestCase { /** * @var PHP_CodeSniffer The unique CS instance shared by all test cases.