Skip to content

Commit

Permalink
Replace deprecated methods in PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Jul 19, 2024
1 parent 052a189 commit 0d952d6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/Fixtures/HelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/Serializer/ArraySerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ 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', []],
['string', 'string'],
['integer', 1],
['boolean', true],
['null', null],
]));
]);
$data->method('getKeys')->willReturn([
'AccessObject',
'object',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/V1/DocumentLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function setUp(): void
$this->parent->expects($this->any())
->method('has')
->with('data')
->will($this->returnValue(true));
->willReturn(true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/V1/RelationshipCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/V1/RelationshipLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -173,15 +173,15 @@ 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);

$relationship->expects($this->any())
->method('get')
->with($this->equalTo('data'))
->will($this->returnValue($data));
->willReturn($data);

$link = new RelationshipLink($object, $this->manager, $relationship);

Expand Down

0 comments on commit 0d952d6

Please sign in to comment.