diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d008d38fad3..01711637fd0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -245,17 +245,11 @@ jobs: with: java-version: 1.8 - - name: Build unscoped PHAR for testing - run: ant unscoped-phar-snapshot - - name: Run regular tests with unscoped PHAR - run: ./build/artifacts/phpunit-snapshot.phar - - - name: Build scoped PHAR for testing - run: ant phar-snapshot + run: ant run-regular-tests-with-unscoped-phar - name: Run PHAR-specific tests with scoped PHAR - run: ./build/artifacts/phpunit-snapshot.phar --configuration tests/phar/phpunit.xml + run: ant run-phar-specific-tests-with-scoped-phar - uses: actions/upload-artifact@v2 if: ${{ matrix.php-version == 8.0 }} diff --git a/build.xml b/build.xml index b5cf5a973e4..ff2a152e95b 100644 --- a/build.xml +++ b/build.xml @@ -119,7 +119,7 @@ - + @@ -133,7 +133,7 @@ - + @@ -432,6 +432,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php index ea96b20002b..2878b70b560 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,8 +9,35 @@ */ const TEST_FILES_PATH = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; -if (!defined('PHPUNIT_COMPOSER_INSTALL')) { - define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php'); +if (file_exists(__DIR__ . '/../vendor/autoload.php')) { + if (!defined('PHPUNIT_COMPOSER_INSTALL')) { + define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php'); + } + + require_once __DIR__ . '/../vendor/autoload.php'; + + return; +} + +if (file_exists(__DIR__ . '/autoload.php')) { + if (!defined('__PHPUNIT_PHAR__')) { + define('__PHPUNIT_PHAR__', realpath($_SERVER['_'])); + } + + require_once __DIR__ . '/autoload.php'; + + $jsonFile = dirname(__DIR__) . '/composer.json'; + $base = dirname($jsonFile); + + foreach (json_decode(file_get_contents($jsonFile), true)['autoload-dev']['files'] as $file) { + require_once $base . DIRECTORY_SEPARATOR . $file; + } + + unset($jsonFile, $base, $file); + + return; } -require_once PHPUNIT_COMPOSER_INSTALL; +print 'No test fixture autoloader was registered, exiting.' . \PHP_EOL; + +exit(1);