From ad1b652203bc6b4b616c5e0b529cd848ccd056c8 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Sun, 4 Feb 2024 23:16:40 +0100 Subject: [PATCH 1/3] Allow PHPUnit 11 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 687d50d..a27bf91 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "require": { "php": "^7.3 || ^8", "phpspec/prophecy": "^1.18", - "phpunit/phpunit":"^9.1 || ^10.1" + "phpunit/phpunit":"^9.1 || ^10.1 || ^11.0" }, "autoload": { "psr-4": { From 0c0deb29effc83242de3a321ceb9a46cb1ba4812 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Tue, 6 Feb 2024 14:54:33 +0100 Subject: [PATCH 2/3] Add attributes below annotations for cross compatibility See: * https://github.com/sebastianbergmann/phpunit/issues/5695 * https://github.com/phpspec/prophecy-phpunit/issues/60#issuecomment-1929613331 --- src/ProphecyTrait.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ProphecyTrait.php b/src/ProphecyTrait.php index 494c228..7c9ada2 100644 --- a/src/ProphecyTrait.php +++ b/src/ProphecyTrait.php @@ -3,6 +3,8 @@ namespace Prophecy\PhpUnit; use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Attributes\After; +use PHPUnit\Framework\Attributes\PostCondition; use PHPUnit\Framework\TestCase; use Prophecy\Exception\Doubler\DoubleException; use Prophecy\Exception\Doubler\InterfaceNotFoundException; @@ -57,6 +59,7 @@ protected function prophesize(?string $classOrInterface = null): ObjectProphecy /** * @postCondition */ + #[PostCondition] protected function verifyProphecyDoubles(): void { if ($this->prophet === null) { @@ -75,6 +78,7 @@ protected function verifyProphecyDoubles(): void /** * @after */ + #[After] protected function tearDownProphecy(): void { if (null !== $this->prophet && !$this->prophecyAssertionsCounted) { From ae95f1acaf28667bc41ae3e2f6fbd1269c4f0ad2 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Tue, 6 Feb 2024 18:41:24 +0100 Subject: [PATCH 3/3] Disable coverage to avoid CI failures --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 052dc11..ed3020b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,4 +63,4 @@ jobs: run: composer install --ansi --no-interaction --no-progress - name: Execute Unit Tests - run: vendor/bin/phpunit --coverage-text + run: vendor/bin/phpunit