Skip to content

Commit

Permalink
Do not assume that vendor-dir is a directory called vendor for 3r…
Browse files Browse the repository at this point in the history
…d-party installs.
  • Loading branch information
whatthejeff committed Mar 7, 2013
1 parent d758a18 commit 3c4559d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
13 changes: 6 additions & 7 deletions PHPUnit/Autoload.php
Expand Up @@ -47,16 +47,15 @@
} }


$paths = array( $paths = array(
'/..', __DIR__ . '/../vendor',
'/../../../..' __DIR__ . '/../../..'
); );


foreach ($paths as $path) { foreach ($paths as $path) {
$vendor = __DIR__ . $path . '/vendor'; if (is_dir($path . '/composer') &&
if (is_dir($vendor . '/composer') && is_file($path . '/autoload.php')) {
is_file($vendor . '/autoload.php')) { require_once $path . '/autoload.php';
require_once $vendor . '/autoload.php'; define('PHPUNIT_COMPOSER_INSTALL', $path . '/autoload.php');
define('PHPUNIT_COMPOSER_INSTALL', $vendor . '/autoload.php');


return; return;
} }
Expand Down
13 changes: 6 additions & 7 deletions PHPUnit/Autoload.php.in
Expand Up @@ -47,16 +47,15 @@ if (defined('PHPUNIT_COMPOSER_INSTALL')) {
} }


$paths = array( $paths = array(
'/..', __DIR__ . '/../vendor',
'/../../../..' __DIR__ . '/../../..'
); );


foreach ($paths as $path) { foreach ($paths as $path) {
$vendor = __DIR__ . $path . '/vendor'; if (is_dir($path . '/composer') &&
if (is_dir($vendor . '/composer') && is_file($path . '/autoload.php')) {
is_file($vendor . '/autoload.php')) { require_once $path . '/autoload.php';
require_once $vendor . '/autoload.php'; define('PHPUNIT_COMPOSER_INSTALL', $path . '/autoload.php');
define('PHPUNIT_COMPOSER_INSTALL', $vendor . '/autoload.php');


return; return;
} }
Expand Down

1 comment on commit 3c4559d

@whatthejeff
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastianbergmann, I think this is the final tweak :). I don't think it's necessary to rush out a release for this corner case, though.

Please sign in to comment.