Skip to content

Commit

Permalink
Fix: Remove autoload configuration before running tests with PHAR
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Sep 5, 2024
1 parent 0019770 commit 9c93713
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.github/ export-ignore
/.phive/ export-ignore
/bin/ export-ignore
/phar/ export-ignore
/test/ export-ignore
/.editorconfig export-ignore
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,13 @@ jobs:
name: "phpunit-slow-test-detector-phar"
path: "${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }}"

- name: "Remove autoloader for composer"
run: "composer install --ansi --no-autoloader --no-interaction"
- name: "Remove autoload configuration for composer"
run: "php bin/remove-autoload-configuration.php"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/install@1.9.2"
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run phar tests with phpunit/phpunit:7.5.0"
if: "matrix.phpunit-version == '7.5.0'"
Expand Down
26 changes: 26 additions & 0 deletions bin/remove-autoload-configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

/**
* Copyright (c) 2021-2024 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/phpunit-slow-test-detector
*/

$composerJsonFile = __DIR__ . '/../composer.json';

$composerJson = \json_decode(
\file_get_contents($composerJsonFile),
false
);

$composerJson->autoload = new stdClass();

\file_put_contents($composerJsonFile, \json_encode(
$composerJson,
\JSON_PRETTY_PRINT | \JSON_PRESERVE_ZERO_FRACTION | \JSON_UNESCAPED_SLASHES
));

0 comments on commit 9c93713

Please sign in to comment.