Skip to content

Commit 3c4559d

Browse files
committed
Do not assume that vendor-dir is a directory called vendor for 3rd-party installs.
1 parent d758a18 commit 3c4559d

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

PHPUnit/Autoload.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@
4747
}
4848

4949
$paths = array(
50-
'/..',
51-
'/../../../..'
50+
__DIR__ . '/../vendor',
51+
__DIR__ . '/../../..'
5252
);
5353

5454
foreach ($paths as $path) {
55-
$vendor = __DIR__ . $path . '/vendor';
56-
if (is_dir($vendor . '/composer') &&
57-
is_file($vendor . '/autoload.php')) {
58-
require_once $vendor . '/autoload.php';
59-
define('PHPUNIT_COMPOSER_INSTALL', $vendor . '/autoload.php');
55+
if (is_dir($path . '/composer') &&
56+
is_file($path . '/autoload.php')) {
57+
require_once $path . '/autoload.php';
58+
define('PHPUNIT_COMPOSER_INSTALL', $path . '/autoload.php');
6059

6160
return;
6261
}

PHPUnit/Autoload.php.in

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@ if (defined('PHPUNIT_COMPOSER_INSTALL')) {
4747
}
4848

4949
$paths = array(
50-
'/..',
51-
'/../../../..'
50+
__DIR__ . '/../vendor',
51+
__DIR__ . '/../../..'
5252
);
5353

5454
foreach ($paths as $path) {
55-
$vendor = __DIR__ . $path . '/vendor';
56-
if (is_dir($vendor . '/composer') &&
57-
is_file($vendor . '/autoload.php')) {
58-
require_once $vendor . '/autoload.php';
59-
define('PHPUNIT_COMPOSER_INSTALL', $vendor . '/autoload.php');
55+
if (is_dir($path . '/composer') &&
56+
is_file($path . '/autoload.php')) {
57+
require_once $path . '/autoload.php';
58+
define('PHPUNIT_COMPOSER_INSTALL', $path . '/autoload.php');
6059

6160
return;
6261
}

0 commit comments

Comments
 (0)