Skip to content

Commit 9c93713

Browse files
committed
Fix: Remove autoload configuration before running tests with PHAR
1 parent 0019770 commit 9c93713

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.github/ export-ignore
22
/.phive/ export-ignore
3+
/bin/ export-ignore
34
/phar/ export-ignore
45
/test/ export-ignore
56
/.editorconfig export-ignore

.github/workflows/integrate.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,13 @@ jobs:
742742
name: "phpunit-slow-test-detector-phar"
743743
path: "${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }}"
744744

745-
- name: "Remove autoloader for composer"
746-
run: "composer install --ansi --no-autoloader --no-interaction"
745+
- name: "Remove autoload configuration for composer"
746+
run: "php bin/remove-autoload-configuration.php"
747+
748+
- name: "Install ${{ matrix.dependencies }} dependencies with composer"
749+
uses: "ergebnis/.github/actions/composer/[email protected]"
750+
with:
751+
dependencies: "${{ matrix.dependencies }}"
747752

748753
- name: "Run phar tests with phpunit/phpunit:7.5.0"
749754
if: "matrix.phpunit-version == '7.5.0'"

bin/remove-autoload-configuration.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Copyright (c) 2021-2024 Andreas Möller
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE.md file that was distributed with this source code.
10+
*
11+
* @see https://github.com/ergebnis/phpunit-slow-test-detector
12+
*/
13+
14+
$composerJsonFile = __DIR__ . '/../composer.json';
15+
16+
$composerJson = \json_decode(
17+
\file_get_contents($composerJsonFile),
18+
false
19+
);
20+
21+
$composerJson->autoload = new stdClass();
22+
23+
\file_put_contents($composerJsonFile, \json_encode(
24+
$composerJson,
25+
\JSON_PRETTY_PRINT | \JSON_PRESERVE_ZERO_FRACTION | \JSON_UNESCAPED_SLASHES
26+
));

0 commit comments

Comments
 (0)