Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions tests/Io/TransactionTest.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

use Clue\React\Block;
use Clue\React\Buzz\Io\Transaction;
use Clue\React\Buzz\Message\MessageFactory;
use Clue\React\Buzz\Message\ResponseException;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\RequestInterface;
use RingCentral\Psr7\Response;
use Clue\React\Buzz\Message\MessageFactory;
use React\Promise;
use Clue\React\Block;
use React\EventLoop\Factory;
use React\Stream\ThroughStream;
use React\Promise;
use React\Promise\Deferred;
use React\Stream\ThroughStream;
use RingCentral\Psr7\Response;

class TransactionTest extends TestCase
{
Expand Down Expand Up @@ -182,9 +182,13 @@ public function testCustomRedirectResponseCode333WillFollowLocationHeaderAndSend
// original GET request will respond with custom 333 redirect status code and follow location header
$requestOriginal = $messageFactory->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 () { })
);
Expand Down