From adb58426392836efe3eb98b6d797a6ad3699fe18 Mon Sep 17 00:00:00 2001 From: Heinz Wiesinger Date: Fri, 8 Sep 2023 10:08:05 +0200 Subject: [PATCH] Update tests for failed hook to work with phpunit 10 --- tests/Requests/RequestsTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Requests/RequestsTest.php b/tests/Requests/RequestsTest.php index 58b6b3ab4..f1f9dfdee 100644 --- a/tests/Requests/RequestsTest.php +++ b/tests/Requests/RequestsTest.php @@ -157,7 +157,7 @@ public function testDefaultTransport() { } public function testTransportFailedTriggersRequestsFailedCallback() { - $mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock(); + $mock = $this->getMockedStdClassWithMethods(['failed']); $mock->expects($this->once())->method('failed'); $hooks = new Hooks(); $hooks->register('requests.failed', [$mock, 'failed']); @@ -175,7 +175,7 @@ public function testTransportFailedTriggersRequestsFailedCallback() { } public function testTransportInvalidArgumentTriggersRequestsFailedCallback() { - $mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock(); + $mock = $this->getMockedStdClassWithMethods(['failed']); $mock->expects($this->once())->method('failed'); $hooks = new Hooks(); $hooks->register('requests.failed', [$mock, 'failed']); @@ -299,7 +299,7 @@ public function testInvalidProtocolVersion() { * new issue, and update your server/proxy to support a proper protocol. */ public function testInvalidProtocolVersionTriggersRequestsFailedCallback() { - $mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock(); + $mock = $this->getMockedStdClassWithMethods(['failed']); $mock->expects($this->once())->method('failed'); $hooks = new Hooks(); $hooks->register('requests.failed', [$mock, 'failed']); @@ -337,7 +337,7 @@ public function testSingleCRLFSeparator() { * HTTP/0.9 also appears to use a single CRLF instead of two. */ public function testSingleCRLFSeparatorTriggersRequestsFailedCallback() { - $mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock(); + $mock = $this->getMockedStdClassWithMethods(['failed']); $mock->expects($this->once())->method('failed'); $hooks = new Hooks(); $hooks->register('requests.failed', [$mock, 'failed']); @@ -369,7 +369,7 @@ public function testInvalidStatus() { } public function testInvalidStatusTriggersRequestsFailedCallback() { - $mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock(); + $mock = $this->getMockedStdClassWithMethods(['failed']); $mock->expects($this->once())->method('failed'); $hooks = new Hooks(); $hooks->register('requests.failed', [$mock, 'failed']); @@ -400,7 +400,7 @@ public function test30xWithoutLocation() { } public function testRedirectToExceptionTriggersRequestsFailedCallbackOnce() { - $mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock(); + $mock = $this->getMockedStdClassWithMethods(['failed']); $mock->expects($this->once())->method('failed'); $hooks = new Hooks(); $hooks->register('requests.failed', [$mock, 'failed']); @@ -423,7 +423,7 @@ public function testRedirectToExceptionTriggersRequestsFailedCallbackOnce() { } public function testRedirectToInvalidArgumentTriggersRequestsFailedCallbackOnce() { - $mock = $this->getMockBuilder(stdClass::class)->setMethods(['failed'])->getMock(); + $mock = $this->getMockedStdClassWithMethods(['failed']); $mock->expects($this->once())->method('failed'); $hooks = new Hooks(); $hooks->register('requests.failed', [$mock, 'failed']);