Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit adb5842

Browse files
committedSep 8, 2023
Update tests for failed hook to work with phpunit 10
1 parent 2252a18 commit adb5842

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎tests/Requests/RequestsTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function testDefaultTransport() {
157157
}
158158

159159
public function testTransportFailedTriggersRequestsFailedCallback() {
160-
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock();
160+
$mock = $this->getMockedStdClassWithMethods(['failed']);
161161
$mock->expects($this->once())->method('failed');
162162
$hooks = new Hooks();
163163
$hooks->register('requests.failed', [$mock, 'failed']);
@@ -175,7 +175,7 @@ public function testTransportFailedTriggersRequestsFailedCallback() {
175175
}
176176

177177
public function testTransportInvalidArgumentTriggersRequestsFailedCallback() {
178-
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock();
178+
$mock = $this->getMockedStdClassWithMethods(['failed']);
179179
$mock->expects($this->once())->method('failed');
180180
$hooks = new Hooks();
181181
$hooks->register('requests.failed', [$mock, 'failed']);
@@ -299,7 +299,7 @@ public function testInvalidProtocolVersion() {
299299
* new issue, and update your server/proxy to support a proper protocol.
300300
*/
301301
public function testInvalidProtocolVersionTriggersRequestsFailedCallback() {
302-
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock();
302+
$mock = $this->getMockedStdClassWithMethods(['failed']);
303303
$mock->expects($this->once())->method('failed');
304304
$hooks = new Hooks();
305305
$hooks->register('requests.failed', [$mock, 'failed']);
@@ -337,7 +337,7 @@ public function testSingleCRLFSeparator() {
337337
* HTTP/0.9 also appears to use a single CRLF instead of two.
338338
*/
339339
public function testSingleCRLFSeparatorTriggersRequestsFailedCallback() {
340-
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock();
340+
$mock = $this->getMockedStdClassWithMethods(['failed']);
341341
$mock->expects($this->once())->method('failed');
342342
$hooks = new Hooks();
343343
$hooks->register('requests.failed', [$mock, 'failed']);
@@ -369,7 +369,7 @@ public function testInvalidStatus() {
369369
}
370370

371371
public function testInvalidStatusTriggersRequestsFailedCallback() {
372-
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock();
372+
$mock = $this->getMockedStdClassWithMethods(['failed']);
373373
$mock->expects($this->once())->method('failed');
374374
$hooks = new Hooks();
375375
$hooks->register('requests.failed', [$mock, 'failed']);
@@ -400,7 +400,7 @@ public function test30xWithoutLocation() {
400400
}
401401

402402
public function testRedirectToExceptionTriggersRequestsFailedCallbackOnce() {
403-
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock();
403+
$mock = $this->getMockedStdClassWithMethods(['failed']);
404404
$mock->expects($this->once())->method('failed');
405405
$hooks = new Hooks();
406406
$hooks->register('requests.failed', [$mock, 'failed']);
@@ -423,7 +423,7 @@ public function testRedirectToExceptionTriggersRequestsFailedCallbackOnce() {
423423
}
424424

425425
public function testRedirectToInvalidArgumentTriggersRequestsFailedCallbackOnce() {
426-
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock();
426+
$mock = $this->getMockedStdClassWithMethods(['failed']);
427427
$mock->expects($this->once())->method('failed');
428428
$hooks = new Hooks();
429429
$hooks->register('requests.failed', [$mock, 'failed']);

0 commit comments

Comments
 (0)
Please sign in to comment.