From 0d952d619ff28c5f4a094919997de060e6fb2c7c Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 19 Jul 2024 08:50:11 +0200 Subject: [PATCH] Replace deprecated methods in PHPUnit --- tests/Fixtures/HelperTrait.php | 2 +- tests/Unit/Serializer/ArraySerializerTest.php | 12 ++++++------ tests/Unit/V1/DocumentLinkTest.php | 2 +- tests/Unit/V1/RelationshipCollectionTest.php | 2 +- tests/Unit/V1/RelationshipLinkTest.php | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/Fixtures/HelperTrait.php b/tests/Fixtures/HelperTrait.php index 8da7143..ee81781 100644 --- a/tests/Fixtures/HelperTrait.php +++ b/tests/Fixtures/HelperTrait.php @@ -166,7 +166,7 @@ public function setUpManagerMock(): void $this->manager->expects($this->any()) ->method('getFactory') - ->will($this->returnValue($factory)); + ->willReturn($factory); $this->manager->expects($this->any()) ->method('getParam') diff --git a/tests/Unit/Serializer/ArraySerializerTest.php b/tests/Unit/Serializer/ArraySerializerTest.php index e4b165c..d7e3b88 100644 --- a/tests/Unit/Serializer/ArraySerializerTest.php +++ b/tests/Unit/Serializer/ArraySerializerTest.php @@ -23,7 +23,7 @@ public function testSerialize(): void $object2 = new \stdClass(); $data = $this->createMock(Accessable::class); - $data->method('get')->will($this->returnValueMap([ + $data->method('get')->willReturnMap([ ['AccessObject', $object1], ['object', $object2], ['array', []], @@ -31,7 +31,7 @@ public function testSerialize(): void ['integer', 1], ['boolean', true], ['null', null], - ])); + ]); $data->method('getKeys')->willReturn([ 'AccessObject', 'object', @@ -64,14 +64,14 @@ public function testRecursiveSerialize(): void $stdObject->key = 'value'; $object1 = $this->createMock(Accessable::class); - $object1->method('get')->will($this->returnValueMap([ + $object1->method('get')->willReturnMap([ ['object', $stdObject], ['array', []], ['string', 'string'], ['integer', 1], ['boolean', true], ['null', null], - ])); + ]); $object1->method('getKeys')->willReturn([ 'object', 'array', @@ -82,9 +82,9 @@ public function testRecursiveSerialize(): void ]); $data = $this->createMock(Accessable::class); - $data->method('get')->will($this->returnValueMap([ + $data->method('get')->willReturnMap([ ['AccessObject', $object1], - ])); + ]); $data->method('getKeys')->willReturn([ 'AccessObject', ]); diff --git a/tests/Unit/V1/DocumentLinkTest.php b/tests/Unit/V1/DocumentLinkTest.php index da58837..77ea157 100644 --- a/tests/Unit/V1/DocumentLinkTest.php +++ b/tests/Unit/V1/DocumentLinkTest.php @@ -33,7 +33,7 @@ public function setUp(): void $this->parent->expects($this->any()) ->method('has') ->with('data') - ->will($this->returnValue(true)); + ->willReturn(true); } /** diff --git a/tests/Unit/V1/RelationshipCollectionTest.php b/tests/Unit/V1/RelationshipCollectionTest.php index 9982184..35a5d41 100644 --- a/tests/Unit/V1/RelationshipCollectionTest.php +++ b/tests/Unit/V1/RelationshipCollectionTest.php @@ -121,7 +121,7 @@ public function testCreateWithIdPropertyThrowsException(): void $item->expects($this->any()) ->method('has') ->with($this->equalTo('attributes')) - ->will($this->returnValue(false)); + ->willReturn(false); $object = new \stdClass(); $object->id = '5'; diff --git a/tests/Unit/V1/RelationshipLinkTest.php b/tests/Unit/V1/RelationshipLinkTest.php index 2962623..72ec59e 100644 --- a/tests/Unit/V1/RelationshipLinkTest.php +++ b/tests/Unit/V1/RelationshipLinkTest.php @@ -42,12 +42,12 @@ public function setUp(): void $this->relationship->expects($this->any()) ->method('has') ->with($this->equalTo('data')) - ->will($this->returnValue(true)); + ->willReturn(true); $this->relationship->expects($this->any()) ->method('get') ->with($this->equalTo('data')) - ->will($this->returnValue($collection)); + ->willReturn($collection); } /** @@ -136,7 +136,7 @@ public function testPaginationNotParsedIfRelationshipDataNotExists(): void $relationship->expects($this->any()) ->method('has') ->with($this->equalTo('data')) - ->will($this->returnValue(false)); + ->willReturn(false); $link = new RelationshipLink($object, $this->manager, $relationship); @@ -173,7 +173,7 @@ public function testPaginationNotParsedIfRelationshipIdentifierCollectionNotExis $relationship->expects($this->any()) ->method('has') ->with($this->equalTo('data')) - ->will($this->returnValue(true)); + ->willReturn(true); // Mock identifier item $data = $this->createMock(Accessable::class); @@ -181,7 +181,7 @@ public function testPaginationNotParsedIfRelationshipIdentifierCollectionNotExis $relationship->expects($this->any()) ->method('get') ->with($this->equalTo('data')) - ->will($this->returnValue($data)); + ->willReturn($data); $link = new RelationshipLink($object, $this->manager, $relationship);