From e0417db846fa3ebcd74ca6794ca8569e6104361e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Wed, 25 Feb 2026 13:27:31 +0100 Subject: [PATCH] Fix tests compatibility with PHP 8.5 and PHPUnit 13 --- .github/workflows/tests.yml | 4 ++++ composer.json | 2 +- phpunit.xml.dist | 2 +- src/Pimple/Tests/PimpleTest.php | 15 ++++++++++++--- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0255c77c..6ff41af0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,6 +12,10 @@ jobs: fail-fast: false matrix: php: + - "7.2" + - "7.3" + - "7.4" + - "8.0" - "8.1" - "8.2" - "8.3" diff --git a/composer.json b/composer.json index 7e3923f3..15ff22be 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.4.x-dev" + "dev-master": "3.x-dev" } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5c8d487f..ab6b5455 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ @@ -204,7 +205,14 @@ public function testRawHonorsNullValues() public function testFluentRegister() { $pimple = new Container(); - $this->assertSame($pimple, $pimple->register($this->getMockBuilder('Pimple\ServiceProviderInterface')->getMock())); + + $stub = new class implements ServiceProviderInterface { + public function register(Container $pimple) + { + } + }; + + $this->assertSame($pimple, $pimple->register($stub)); } public function testRawValidatesKeyIsPresent() @@ -275,13 +283,13 @@ public function testExtendDoesNotLeakWithFactories() unset($pimple['foo']); $p = new \ReflectionProperty($pimple, 'values'); - if (PHP_VERSION < 80100) { + if (PHP_VERSION_ID < 80100) { $p->setAccessible(true); } $this->assertEmpty($p->getValue($pimple)); $p = new \ReflectionProperty($pimple, 'factories'); - if (PHP_VERSION < 80100) { + if (PHP_VERSION_ID < 80100) { $p->setAccessible(true); } $this->assertCount(0, $p->getValue($pimple)); @@ -425,6 +433,7 @@ public function testLegacyExtendFailsForKeysNotContainingServiceDefinitions($ser /** * @group legacy * @expectedDeprecation How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "foo" should be protected? + * @dataProvider badServiceDefinitionProvider */ #[DataProvider('badServiceDefinitionProvider')] public function testExtendingProtectedClosureDeprecation($service)