diff --git a/.github/workflows/collision-tests.yaml b/.github/workflows/collision-tests.yaml index 0bd1bc0b..dc929791 100644 --- a/.github/workflows/collision-tests.yaml +++ b/.github/workflows/collision-tests.yaml @@ -45,7 +45,7 @@ jobs: composer show -D - name: Execute tests (with deprecations on PHPUnit 10) - run: ./testbench package:test --exclude-group commander + run: php testbench package:test --exclude-group commander env: RAY_ENABLED: false @@ -88,7 +88,7 @@ jobs: composer show -D - name: Execute tests - run: ./testbench package:test --coverage --exclude-group commander --exclude-group deprecations + run: php testbench package:test --coverage --exclude-group commander --exclude-group deprecations env: RAY_ENABLED: false TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS: false diff --git a/.github/workflows/parallel-tests.yaml b/.github/workflows/parallel-tests.yaml index 42baacd7..8f3367ca 100644 --- a/.github/workflows/parallel-tests.yaml +++ b/.github/workflows/parallel-tests.yaml @@ -19,10 +19,17 @@ jobs: paratest: - "^7.3" phpunit: - - "^10.5" - - "^11.0" + - "~10.5.35" + - "~11.3.6" + - "~11.4.0" + - "~11.5.0" experimental: - false + exclude: + - php: 8.4 + phpunit: "~10.5.35" + - php: 8.4 + phpunit: "~11.3.6" name: PHP:${{ matrix.php }} / Paratest:${{ matrix.paratest }} / PHPUnit:${{ matrix.phpunit }} ⬆️ @@ -51,14 +58,8 @@ jobs: run: | composer show -D - - name: Execute tests (with deprecations) - run: ./testbench package:test --parallel --exclude-group commander,without-parallel,database,session --no-coverage + - name: Execute tests + run: php testbench package:test --parallel ${{ matrix.phpunit == '~10.5.35' && '--exclude-group commander,without-parallel,database,session --no-coverage' || '--exclude-group commander --exclude-group without-parallel --exclude-group database --exclude-group session --no-coverage' }} env: RAY_ENABLED: false - if: matrix.phpunit == '^10.5' - - - name: Execute tests (with deprecations) - run: ./testbench package:test --parallel --exclude-group commander --exclude-group without-parallel --exclude-group database --exclude-group session --no-coverage - env: - RAY_ENABLED: false - if: matrix.phpunit != '^10.5' + if: matrix.phpunit != '~10.5.35' diff --git a/.github/workflows/strict-tests.yaml b/.github/workflows/strict-tests.yaml index 124fe688..dca8cd4b 100644 --- a/.github/workflows/strict-tests.yaml +++ b/.github/workflows/strict-tests.yaml @@ -20,6 +20,7 @@ jobs: - "~10.5.0" - "~11.3.0" - "~11.4.0" + - "~11.5.0" experimental: - false diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fefbfcb5..e080ddaa 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -24,6 +24,7 @@ jobs: - "~10.5.0" - "~11.3.0" - "~11.4.0" + - "~11.5.0" dependencies: - "highest" - "lowest" diff --git a/composer.json b/composer.json index f645659d..d02b4bff 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,7 @@ "laravel/framework": "<11.33.2 || >=12.0.0", "laravel/serializable-closure": "<1.3.0 || >=3.0.0", "nunomaduro/collision": "<8.0.0 || >=9.0.0", - "phpunit/phpunit": "<10.5.35 || >=11.0.0 <11.3.6 || >=11.5.0" + "phpunit/phpunit": "<10.5.35 || >=11.0.0 <11.3.6 || >=11.6.0" }, "suggest": { "ext-pcntl": "Required to use all features of the console signal trapping.", diff --git a/src/Exceptions/DeprecatedException.php b/src/Exceptions/DeprecatedException.php index 1d813b01..9090d7a5 100644 --- a/src/Exceptions/DeprecatedException.php +++ b/src/Exceptions/DeprecatedException.php @@ -4,6 +4,8 @@ use PHPUnit\Util\Filter; +use function Orchestra\Testbench\phpunit_version_compare; + /** * @codeCoverageIgnore */ @@ -16,6 +18,10 @@ class DeprecatedException extends PHPUnitErrorException */ public function __toString(): string { - return \sprintf('%s'.PHP_EOL.PHP_EOL.'%s', $this->getMessage(), Filter::getFilteredStacktrace($this)); + $stackTrace = phpunit_version_compare('11.5', '>=') + ? Filter::stackTraceFromThrowableAsString($this) + : Filter::getFilteredStacktrace($this); + + return \sprintf('%s'.PHP_EOL.PHP_EOL.'%s', $this->getMessage(), $stackTrace); } } diff --git a/src/functions.php b/src/functions.php index 69671b03..79a2617b 100644 --- a/src/functions.php +++ b/src/functions.php @@ -366,8 +366,11 @@ function laravel_vendor_exists(ApplicationContract $app, ?string $workingPath = */ function laravel_version_compare(string $version, ?string $operator = null): int|bool { - /** @phpstan-ignore identical.alwaysFalse */ - $laravel = Application::VERSION === '11.x-dev' ? '11.0.0' : Application::VERSION; + /** @var string $laravel */ + $laravel = transform( + Application::VERSION, + fn (string $version) => $version === '11.x-dev' ? '11.0.0' : $version, // @phpstan-ignore identical.alwaysFalse + ); if (\is_null($operator)) { return version_compare($laravel, $version); @@ -393,11 +396,17 @@ function phpunit_version_compare(string $version, ?string $operator = null): int throw new RuntimeException('Unable to verify PHPUnit version'); } + /** @var string $phpunit */ + $phpunit = transform( + Version::id(), + fn (string $version) => $version === '11.5-dev' ? '11.5.0' : $version, + ); + if (\is_null($operator)) { - return version_compare(Version::id(), $version); + return version_compare($phpunit, $version); } - return version_compare(Version::id(), $version, $operator); + return version_compare($phpunit, $version, $operator); } /** diff --git a/tests/HelpersTest.php b/tests/HelpersTest.php index 267ba062..8f022de5 100644 --- a/tests/HelpersTest.php +++ b/tests/HelpersTest.php @@ -24,7 +24,9 @@ public function it_can_compare_laravel_version() #[Test] public function it_can_compare_phpunit_version() { - $this->assertSame(0, phpunit_version_compare(Version::id())); - $this->assertTrue(phpunit_version_compare(Version::id(), '==')); + $phpunit = Version::id() === '11.5-dev' ? '11.5.0' : Version::id(); + + $this->assertSame(0, phpunit_version_compare($phpunit)); + $this->assertTrue(phpunit_version_compare($phpunit, '==')); } }