From e4104e37886e1cc0b253d357e177fa3af8ab8a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sun, 22 Dec 2019 18:03:25 +0100 Subject: [PATCH] Fix testing redirected request when following relative redirect --- tests/Io/TransactionTest.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/Io/TransactionTest.php b/tests/Io/TransactionTest.php index 371fc74..c1f608c 100644 --- a/tests/Io/TransactionTest.php +++ b/tests/Io/TransactionTest.php @@ -1,16 +1,16 @@ request('GET', 'http://example.com'); $response = $messageFactory->response(1.0, 333, null, array('Location' => 'foo')); - $requestRedirected = $messageFactory->request('GET', 'http://example.com/foo'); $sender = $this->makeSenderMock(); - $sender->expects($this->exactly(2))->method('send')->withConsecutive($requestOriginal, $requestRedirected)->willReturnOnConsecutiveCalls( + $sender->expects($this->exactly(2))->method('send')->withConsecutive( + array($requestOriginal), + array($this->callback(function (RequestInterface $request) { + return $request->getMethod() === 'GET' && (string)$request->getUri() === 'http://example.com/foo'; + })) + )->willReturnOnConsecutiveCalls( Promise\resolve($response), new \React\Promise\Promise(function () { }) );