|  | 
| 9 | 9 |  */ | 
| 10 | 10 | const TEST_FILES_PATH = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; | 
| 11 | 11 | 
 | 
| 12 |  | -if (file_exists(__DIR__ . '/../vendor/autoload.php') && file_exists(__DIR__ . '/autoload.php')) { | 
| 13 |  | - print 'More than one test fixture autoloader is available, exiting.' . \PHP_EOL; | 
|  | 12 | +$composer = file_exists(__DIR__ . '/../vendor/autoload.php'); | 
|  | 13 | +$phar = file_exists(__DIR__ . '/autoload.php'); | 
|  | 14 | + | 
|  | 15 | +if ($composer && $phar) { | 
|  | 16 | + print 'More than one test fixture autoloader is available, exiting.' . PHP_EOL; | 
|  | 17 | + | 
|  | 18 | + exit(1); | 
|  | 19 | +} | 
|  | 20 | + | 
|  | 21 | +if (!$composer && !$phar) { | 
|  | 22 | + print 'No test fixture autoloader was registered, exiting.' . PHP_EOL; | 
| 14 | 23 | 
 | 
| 15 | 24 |  exit(1); | 
| 16 | 25 | } | 
| 17 | 26 | 
 | 
| 18 |  | -if (file_exists(__DIR__ . '/../vendor/autoload.php')) { | 
|  | 27 | +if ($composer) { | 
| 19 | 28 |  if (!defined('PHPUNIT_COMPOSER_INSTALL')) { | 
| 20 | 29 |  define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php'); | 
| 21 | 30 |  } | 
| 22 | 31 | 
 | 
| 23 | 32 |  require_once __DIR__ . '/../vendor/autoload.php'; | 
| 24 |  | - | 
| 25 |  | - return; | 
| 26 | 33 | } | 
| 27 | 34 | 
 | 
| 28 |  | -if (file_exists(__DIR__ . '/autoload.php')) { | 
|  | 35 | +if ($phar) { | 
| 29 | 36 |  if (!defined('__PHPUNIT_PHAR__')) { | 
| 30 | 37 |  require_once __DIR__ . '/../build/artifacts/phpunit-snapshot.phar'; | 
| 31 | 38 |  } | 
|  | 
| 38 | 45 |  foreach (json_decode(file_get_contents($jsonFile), true)['autoload-dev']['files'] as $file) { | 
| 39 | 46 |  require_once $base . DIRECTORY_SEPARATOR . $file; | 
| 40 | 47 |  } | 
| 41 |  | - | 
| 42 |  | - unset($jsonFile, $base, $file); | 
| 43 |  | - | 
| 44 |  | - return; | 
| 45 | 48 | } | 
| 46 | 49 | 
 | 
| 47 |  | -print 'No test fixture autoloader was registered, exiting.' . \PHP_EOL; | 
| 48 |  | - | 
| 49 |  | -exit(1); | 
|  | 50 | +unset($composer, $phar, $jsonFile, $base, $file); | 
0 commit comments