X Tutup
Skip to content

Commit e0417db

Browse files
GromNaNfabpot
authored andcommitted
Fix tests compatibility with PHP 8.5 and PHPUnit 13
1 parent 0200298 commit e0417db

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
php:
15+
- "7.2"
16+
- "7.3"
17+
- "7.4"
18+
- "8.0"
1519
- "8.1"
1620
- "8.2"
1721
- "8.3"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"extra": {
2525
"branch-alias": {
26-
"dev-master": "3.4.x-dev"
26+
"dev-master": "3.x-dev"
2727
}
2828
}
2929
}

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"

src/Pimple/Tests/PimpleTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use PHPUnit\Framework\Attributes\DataProvider;
3030
use PHPUnit\Framework\TestCase;
3131
use Pimple\Container;
32+
use Pimple\ServiceProviderInterface;
3233

3334
/**
3435
* @author Igor Wiedler <igor@wiedler.ch>
@@ -204,7 +205,14 @@ public function testRawHonorsNullValues()
204205
public function testFluentRegister()
205206
{
206207
$pimple = new Container();
207-
$this->assertSame($pimple, $pimple->register($this->getMockBuilder('Pimple\ServiceProviderInterface')->getMock()));
208+
209+
$stub = new class implements ServiceProviderInterface {
210+
public function register(Container $pimple)
211+
{
212+
}
213+
};
214+
215+
$this->assertSame($pimple, $pimple->register($stub));
208216
}
209217

210218
public function testRawValidatesKeyIsPresent()
@@ -275,13 +283,13 @@ public function testExtendDoesNotLeakWithFactories()
275283
unset($pimple['foo']);
276284

277285
$p = new \ReflectionProperty($pimple, 'values');
278-
if (PHP_VERSION < 80100) {
286+
if (PHP_VERSION_ID < 80100) {
279287
$p->setAccessible(true);
280288
}
281289
$this->assertEmpty($p->getValue($pimple));
282290

283291
$p = new \ReflectionProperty($pimple, 'factories');
284-
if (PHP_VERSION < 80100) {
292+
if (PHP_VERSION_ID < 80100) {
285293
$p->setAccessible(true);
286294
}
287295
$this->assertCount(0, $p->getValue($pimple));
@@ -425,6 +433,7 @@ public function testLegacyExtendFailsForKeysNotContainingServiceDefinitions($ser
425433
/**
426434
* @group legacy
427435
* @expectedDeprecation How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "foo" should be protected?
436+
* @dataProvider badServiceDefinitionProvider
428437
*/
429438
#[DataProvider('badServiceDefinitionProvider')]
430439
public function testExtendingProtectedClosureDeprecation($service)

0 commit comments

Comments
 (0)
X Tutup