Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b40c84d

Browse files
[Bridge/PhpUnit] move .phpunit/ out of phpunit-bridge/
1 parent 21eb340 commit b40c84d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ if (PHP_VERSION_ID >= 70200) {
2626
$PHPUNIT_VERSION = '4.8';
2727
}
2828

29+
if (file_exists(($path = dirname(__DIR__)).'/composer.json')) {
30+
if (file_exists($path.'/vendor/symfony/phpunit-bridge/composer.json')) {
31+
$path .= '/vendor/symfony/phpunit-bridge';
32+
}
33+
} elseif (file_exists($path.'/symfony/phpunit-bridge/composer.json')) {
34+
$path .= '/symfony/phpunit-bridge';
35+
}
36+
2937
$oldPwd = getcwd();
30-
$PHPUNIT_DIR = getenv('SYMFONY_PHPUNIT_DIR') ?: (__DIR__.'/.phpunit');
38+
$PHPUNIT_DIR = getenv('SYMFONY_PHPUNIT_DIR') ?: (dirname(dirname(__DIR__) === $path ? $path : __DIR__).'/.phpunit');
3139
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
3240
$PHP = escapeshellarg($PHP);
3341
if ('phpdbg' === PHP_SAPI) {
@@ -69,15 +77,8 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
6977
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
7078
}
7179
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*\"");
72-
if (file_exists(($path = dirname(__DIR__)).'/composer.json')) {
73-
if (file_exists($path.'/vendor/symfony/phpunit-bridge/composer.json')) {
74-
$path .= '/vendor/symfony/phpunit-bridge';
75-
}
76-
} elseif (file_exists($path.'/symfony/phpunit-bridge/composer.json')) {
77-
$path .= '/symfony/phpunit-bridge';
78-
}
7980
if (file_exists($path)) {
80-
passthru("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg($path));
81+
passthru("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path)));
8182
}
8283
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
8384
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");

0 commit comments

Comments
 (0)