diff --git a/tests/AllTests.php b/tests/AllTests.php index 4ed001dfed..9d099c1e3d 100644 --- a/tests/AllTests.php +++ b/tests/AllTests.php @@ -9,16 +9,13 @@ namespace PHP_CodeSniffer\Tests; -$GLOBALS['PHP_CODESNIFFER_PEAR'] = false; - -if (is_file(__DIR__.'/../autoload.php') === true) { +if ($GLOBALS['PHP_CODESNIFFER_PEAR'] === false) { include_once 'Core/AllTests.php'; include_once 'Standards/AllSniffs.php'; } else { include_once 'CodeSniffer/Core/AllTests.php'; include_once 'CodeSniffer/Standards/AllSniffs.php'; include_once 'FileList.php'; - $GLOBALS['PHP_CODESNIFFER_PEAR'] = true; } // PHPUnit 7 made the TestSuite run() method incompatible with diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 560253c6a7..47084d1135 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -44,6 +44,13 @@ class_alias('PHPUnit_TextUI_TestRunner', 'PHPUnit'.'\TextUI\TestRunner'); class_alias('PHPUnit_Framework_TestResult', 'PHPUnit'.'\Framework\TestResult'); } +// Determine whether this is a PEAR install or not. +$GLOBALS['PHP_CODESNIFFER_PEAR'] = false; + +if (is_file(__DIR__.'/../autoload.php') === false) { + $GLOBALS['PHP_CODESNIFFER_PEAR'] = true; +} + /** * A global util function to help print unit test fixing data.