Skip to content

Commit 58da926

Browse files
Refactor
1 parent 39e2172 commit 58da926

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

tests/bootstrap.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,30 @@
99
*/
1010
const TEST_FILES_PATH = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR;
1111

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;
1423

1524
exit(1);
1625
}
1726

18-
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
27+
if ($composer) {
1928
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
2029
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php');
2130
}
2231

2332
require_once __DIR__ . '/../vendor/autoload.php';
24-
25-
return;
2633
}
2734

28-
if (file_exists(__DIR__ . '/autoload.php')) {
35+
if ($phar) {
2936
if (!defined('__PHPUNIT_PHAR__')) {
3037
require_once __DIR__ . '/../build/artifacts/phpunit-snapshot.phar';
3138
}
@@ -38,12 +45,6 @@
3845
foreach (json_decode(file_get_contents($jsonFile), true)['autoload-dev']['files'] as $file) {
3946
require_once $base . DIRECTORY_SEPARATOR . $file;
4047
}
41-
42-
unset($jsonFile, $base, $file);
43-
44-
return;
4548
}
4649

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

Comments
 (0)