Skip to content

Commit

Permalink
NOBUG: Allow the tests to work under various phpunit versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jan 19, 2018
1 parent 0d32140 commit e15d079
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/local_codechecker_testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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.
Expand Down

0 comments on commit e15d079

Please sign in to comment.