Skip to content

Commit 3b9c2af

Browse files
Merge branch '8.5' into 9.5
2 parents ec80357 + f544273 commit 3b9c2af

File tree

3 files changed

+67
-15
lines changed

3 files changed

+67
-15
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,11 @@ jobs:
252252
with:
253253
java-version: 1.8
254254

255-
- name: Build unscoped PHAR for testing
256-
run: ant unscoped-phar-snapshot
255+
- name: Run regular unit tests with unscoped PHAR
256+
run: ant run-regular-tests-with-unscoped-phar
257257

258-
- name: Run regular tests with unscoped PHAR
259-
run: ./build/artifacts/phpunit-snapshot.phar
260-
261-
- name: Build scoped PHAR for testing
262-
run: ant phar-snapshot
263-
264-
- name: Run PHAR-specific tests with scoped PHAR
265-
run: ./build/artifacts/phpunit-snapshot.phar --configuration tests/phar/phpunit.xml --coverage-text
258+
- name: Run PHAR-specific end-to-end tests with scoped PHAR
259+
run: ant run-phar-specific-tests-with-scoped-phar
266260

267261
- uses: actions/upload-artifact@v2
268262
if: ${{ matrix.php-version == 8.0 }}

build.xml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
</antcall>
101101
</target>
102102

103-
<target name="unscoped-phar" depends="-phar-prepare,-phar-determine-version" description="Create PHAR archive of PHPUnit and all its dependencies">
103+
<target name="unscoped-phar" depends="-phar-prepare,-phar-determine-version" description="Create unscoped PHAR archive of PHPUnit and all its dependencies">
104104
<antcall target="-phar-build">
105105
<param name="type" value="release"/>
106106
<param name="scope" value="false"/>
@@ -114,7 +114,7 @@
114114
</antcall>
115115
</target>
116116

117-
<target name="unscoped-phar-snapshot" depends="-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies (snapshot)">
117+
<target name="unscoped-phar-snapshot" depends="-phar-prepare" description="Create unscoped PHAR archive of PHPUnit and all its dependencies (snapshot)">
118118
<antcall target="-phar-build">
119119
<param name="type" value="snapshot"/>
120120
<param name="scope" value="false"/>
@@ -449,6 +449,37 @@
449449
<exec executable="${basedir}/build/scripts/version.php" outputproperty="version" failonerror="true" />
450450
</target>
451451

452+
<target name="run-regular-tests-with-unscoped-phar" depends="clean,unscoped-phar-snapshot" description="Build unscoped PHAR snapshot and run the regular test suite with it">
453+
<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
454+
<arg value="--output" />
455+
<arg path="${basedir}/tests/autoload.php" />
456+
<arg path="${basedir}/tests/_files" />
457+
<arg path="${basedir}/tests/end-to-end/execution-order/_files" />
458+
<arg path="${basedir}/tests/unit" />
459+
</exec>
460+
461+
<delete dir="${basedir}/vendor"/>
462+
<delete file="${basedir}/composer.lock"/>
463+
464+
<exec executable="${basedir}/build/artifacts/phpunit-snapshot.phar" taskname="phpunit" failonerror="true">
465+
<arg value="--testsuite" />
466+
<arg value="unit" />
467+
</exec>
468+
469+
<delete file="${basedir}/tests/autoload.php"/>
470+
</target>
471+
472+
<target name="run-phar-specific-tests-with-scoped-phar" depends="clean,phar-snapshot" description="Build scoped PHAR snapshot and run the PHAR-specific tests with it">
473+
<delete dir="${basedir}/vendor"/>
474+
<delete file="${basedir}/composer.lock"/>
475+
476+
<exec executable="${basedir}/build/artifacts/phpunit-snapshot.phar" taskname="phpunit" failonerror="true">
477+
<arg value="--configuration" />
478+
<arg value="tests/phar/phpunit.xml" />
479+
<arg value="--coverage-text" />
480+
</exec>
481+
</target>
482+
452483
<target name="generate-project-documentation" depends="-phploc,-checkstyle,-phpunit">
453484
<exec executable="${basedir}/tools/phpdox" dir="${basedir}/build/config" taskname="phpdox"/>
454485
</target>

tests/bootstrap.php

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

12-
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
13-
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php');
12+
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
13+
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
14+
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php');
15+
}
16+
17+
require_once __DIR__ . '/../vendor/autoload.php';
18+
19+
return;
20+
}
21+
22+
if (file_exists(__DIR__ . '/autoload.php')) {
23+
if (!defined('__PHPUNIT_PHAR__')) {
24+
define('__PHPUNIT_PHAR__', realpath($_SERVER['_']));
25+
}
26+
27+
require_once __DIR__ . '/autoload.php';
28+
29+
$jsonFile = dirname(__DIR__) . '/composer.json';
30+
$base = dirname($jsonFile);
31+
32+
foreach (json_decode(file_get_contents($jsonFile), true)['autoload-dev']['files'] as $file) {
33+
require_once $base . DIRECTORY_SEPARATOR . $file;
34+
}
35+
36+
unset($jsonFile, $base, $file);
37+
38+
return;
1439
}
1540

16-
require_once PHPUNIT_COMPOSER_INSTALL;
41+
print 'No test fixture autoloader was registered, exiting.' . \PHP_EOL;
42+
43+
exit(1);

0 commit comments

Comments
 (0)