From 771a0c64076d8490a8380a61cb581c7bda128fca Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Fri, 6 Dec 2024 22:17:35 -0800 Subject: [PATCH 1/3] phpunit.xml: check PHPUnit deprecations By default, PHPUnit deprecations are hidden. We now make them a visible error so that they can be fixed in a timely manner. --- phpunit.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index 681d5389f..97f9ce8cd 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,13 +6,16 @@ bootstrap="src/bootstrap.php" cacheDirectory=".phpunit.cache" colors="true" + displayDetailsOnPhpunitDeprecations="true" displayDetailsOnTestsThatTriggerDeprecations="true" displayDetailsOnTestsThatTriggerErrors="true" displayDetailsOnTestsThatTriggerNotices="true" displayDetailsOnTestsThatTriggerWarnings="true" executionOrder="depends,defects" failOnDeprecation="true" + failOnEmptyTestSuite="true" failOnNotice="true" + failOnPhpunitDeprecation="true" failOnRisky="true" failOnWarning="true" requireCoverageMetadata="true"> From e6ea66b95b01527aac46da39dc1646ec10107cf5 Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Fri, 6 Dec 2024 22:27:22 -0800 Subject: [PATCH 2/3] phpunit.xml: migrate schema Run the migration command with PHPUnit 11.5 to update the schema. Only one non-trivial change was made: * `includeUncoveredFiles` was removed because true is the default --- phpunit.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 97f9ce8cd..5b22e513a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,7 @@ - + From 5b1ea212b7c9c50a73fc7e432b38fbff2c6edf8c Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Fri, 6 Dec 2024 22:38:03 -0800 Subject: [PATCH 3/3] Fix PHPUnit deprecation > Targeting a trait such as Smr\Container\ResettableContainerTrait with #[CoversTrait] is deprecated. The traits used by the class(es) you target with #[CoversClass] will be targeted as well. Presumably this is the correct thing to do and won't change the coverage results. --- ...eContainerTraitTest.php => ResettableContainerTest.php} | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename test/SmrTest/Container/{ResettableContainerTraitTest.php => ResettableContainerTest.php} (92%) diff --git a/test/SmrTest/Container/ResettableContainerTraitTest.php b/test/SmrTest/Container/ResettableContainerTest.php similarity index 92% rename from test/SmrTest/Container/ResettableContainerTraitTest.php rename to test/SmrTest/Container/ResettableContainerTest.php index 8c9eb6c3b..d44dcc8a5 100644 --- a/test/SmrTest/Container/ResettableContainerTraitTest.php +++ b/test/SmrTest/Container/ResettableContainerTest.php @@ -2,13 +2,12 @@ namespace SmrTest\Container; -use PHPUnit\Framework\Attributes\CoversTrait; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Smr\Container\ResettableContainer; -use Smr\Container\ResettableContainerTrait; -#[CoversTrait(ResettableContainerTrait::class)] -class ResettableContainerTraitTest extends TestCase { +#[CoversClass(ResettableContainer::class)] +class ResettableContainerTest extends TestCase { public function test_not_initialized_by_definition(): void { $container = new ResettableContainer([