From 96c13c6fcfde60919ea3fe05eb7a4283d90fdd64 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 Sep 2023 10:49:12 +0200 Subject: [PATCH 1/3] Allow phpunit 10 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 63c7d4a..5f6a880 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "opis/closure": "Allow to serialize PHP closures" }, "require-dev": { - "phpunit/phpunit": ">=6.0 <10.0" + "phpunit/phpunit": ">=6.0 <11.0" }, "autoload": { "psr-4": { From 0a3bac1f7f9a6a80ff4d7f46c84cfab0e0d93b25 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 Sep 2023 10:58:00 +0200 Subject: [PATCH 2/3] Avoid tests to fail if providers are missing --- tests/ClosureSerializer/ClosureSerializerManagerTest.php | 7 +++++++ tests/ClosureSerializer/OpisClosureSerializerTest.php | 7 +++++++ tests/ClosureSerializer/SuperClosureSerializerTest.php | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/tests/ClosureSerializer/ClosureSerializerManagerTest.php b/tests/ClosureSerializer/ClosureSerializerManagerTest.php index b33dfef..b52abf4 100644 --- a/tests/ClosureSerializer/ClosureSerializerManagerTest.php +++ b/tests/ClosureSerializer/ClosureSerializerManagerTest.php @@ -8,6 +8,13 @@ class ClosureSerializerManagerTest extends TestCase { + public function setUp(): void + { + if (! class_exists(\SuperClosure\SerializerInterface::class)) { + $this->markTestSkipped('Missing jeremeamia/superclosure to run this test'); + } + } + public function testAddSerializer() { $manager = new ClosureSerializerManager(); $this->assertEmpty($manager->getSerializer('foo')); diff --git a/tests/ClosureSerializer/OpisClosureSerializerTest.php b/tests/ClosureSerializer/OpisClosureSerializerTest.php index 5950c23..54708a1 100644 --- a/tests/ClosureSerializer/OpisClosureSerializerTest.php +++ b/tests/ClosureSerializer/OpisClosureSerializerTest.php @@ -7,6 +7,13 @@ class OpisClosureSerializerTest extends TestCase { + public function setUp(): void + { + if (! class_exists(\Opis\Closure\SerializableClosure::class)) { + $this->markTestSkipped('Missing opis/closure to run this test'); + } + } + public function testSerialize() { $closure = function() { return 'foo'; diff --git a/tests/ClosureSerializer/SuperClosureSerializerTest.php b/tests/ClosureSerializer/SuperClosureSerializerTest.php index 7ba40c3..092220e 100644 --- a/tests/ClosureSerializer/SuperClosureSerializerTest.php +++ b/tests/ClosureSerializer/SuperClosureSerializerTest.php @@ -7,6 +7,13 @@ class SuperClosureSerializerTest extends TestCase { + public function setUp(): void + { + if (! class_exists(\SuperClosure\SerializerInterface::class)) { + $this->markTestSkipped('Missing jeremeamia/superclosure to run this test'); + } + } + public function testSerialize() { $closure = function() { return 'foo'; From cbdc134505008b2063a218dc5bca1f879e0adc2b Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 23 Sep 2023 10:59:36 +0200 Subject: [PATCH 3/3] Make data providers static for phpunit 10 --- tests/JsonSerializerTest.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/JsonSerializerTest.php b/tests/JsonSerializerTest.php index 15fd8df..afa4512 100644 --- a/tests/JsonSerializerTest.php +++ b/tests/JsonSerializerTest.php @@ -81,10 +81,8 @@ public function testUnserializeScalar($scalar, $jsoned) /** * List of scalar data - * - * @return array */ - public function scalarData() + public static function scalarData(): array { return array( array('testing', '"testing"'), @@ -156,10 +154,8 @@ public function testUnserializeArrayNoObject($array, $jsoned) /** * List of array data - * - * @return array */ - public function arrayNoObjectData() + public static function arrayNoObjectData(): array { return array( array(array(1, 2, 3), '[1,2,3]'),