Skip to content

Commit

Permalink
Fix test error due to conflict between #91 and #95
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Feb 9, 2018
1 parent f56a136 commit 315d453
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/Io/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ public function testFollowingRedirectWithSpecifiedHeaders()
{
$messageFactory = new MessageFactory();

$customHeaders = ['User-Agent' => 'Chrome'];
$customHeaders = array('User-Agent' => 'Chrome');
$requestWithUserAgent = $messageFactory->request('GET', 'http://example.com', $customHeaders);
$sender = $this->makeSenderMock();

// mock sender to resolve promise with the given $redirectResponse in
// response to the given $requestWithUserAgent
$redirectResponse = $messageFactory->response(1.0, 301, null, ['Location' => 'http://redirect.com']);
$redirectResponse = $messageFactory->response(1.0, 301, null, array('Location' => 'http://redirect.com'));
$sender->expects($this->at(0))->method('send')->willReturn(Promise\resolve($redirectResponse));

// mock sender to resolve promise with the given $okResponse in
Expand All @@ -126,25 +126,25 @@ public function testFollowingRedirectWithSpecifiedHeaders()
$sender->expects($this->at(1))
->method('send')
->with($this->callback(function (RequestInterface $request) {
$this->assertEquals(['Chrome'], $request->getHeader('User-Agent'));
$this->assertEquals(array('Chrome'), $request->getHeader('User-Agent'));
return true;
}))->willReturn(Promise\resolve($okResponse));

$transaction = new Transaction($requestWithUserAgent, $sender, [], $messageFactory);
$transaction = new Transaction($requestWithUserAgent, $sender, array(), $messageFactory);
$transaction->send();
}

public function testRemovingAuthorizationHeaderWhenChangingHostnamesDuringRedirect()
{
$messageFactory = new MessageFactory();

$customHeaders = ['Authentication' => 'secret'];
$customHeaders = array('Authentication' => 'secret');
$requestWithAuthentication = $messageFactory->request('GET', 'http://example.com', $customHeaders);
$sender = $this->makeSenderMock();

// mock sender to resolve promise with the given $redirectResponse in
// response to the given $requestWithAuthentication
$redirectResponse = $messageFactory->response(1.0, 301, null, ['Location' => 'http://redirect.com']);
$redirectResponse = $messageFactory->response(1.0, 301, null, array('Location' => 'http://redirect.com'));
$sender->expects($this->at(0))->method('send')->willReturn(Promise\resolve($redirectResponse));

// mock sender to resolve promise with the given $okResponse in
Expand All @@ -157,21 +157,21 @@ public function testRemovingAuthorizationHeaderWhenChangingHostnamesDuringRedire
return true;
}))->willReturn(Promise\resolve($okResponse));

$transaction = new Transaction($requestWithAuthentication, $sender, [], $messageFactory);
$transaction = new Transaction($requestWithAuthentication, $sender, array(), $messageFactory);
$transaction->send();
}

public function testAuthorizationHeaderIsForwardedWhenRedirectingToSameDomain()
{
$messageFactory = new MessageFactory();

$customHeaders = ['Authentication' => 'secret'];
$customHeaders = array('Authentication' => 'secret');
$requestWithAuthentication = $messageFactory->request('GET', 'http://example.com', $customHeaders);
$sender = $this->makeSenderMock();

// mock sender to resolve promise with the given $redirectResponse in
// response to the given $requestWithAuthentication
$redirectResponse = $messageFactory->response(1.0, 301, null, ['Location' => 'http://example.com/new']);
$redirectResponse = $messageFactory->response(1.0, 301, null, array('Location' => 'http://example.com/new'));
$sender->expects($this->at(0))->method('send')->willReturn(Promise\resolve($redirectResponse));

// mock sender to resolve promise with the given $okResponse in
Expand All @@ -180,29 +180,29 @@ public function testAuthorizationHeaderIsForwardedWhenRedirectingToSameDomain()
$sender->expects($this->at(1))
->method('send')
->with($this->callback(function (RequestInterface $request) {
$this->assertEquals(['secret'], $request->getHeader('Authentication'));
$this->assertEquals(array('secret'), $request->getHeader('Authentication'));
return true;
}))->willReturn(Promise\resolve($okResponse));

$transaction = new Transaction($requestWithAuthentication, $sender, [], $messageFactory);
$transaction = new Transaction($requestWithAuthentication, $sender, array(), $messageFactory);
$transaction->send();
}

public function testSomeRequestHeadersShouldBeRemovedWhenRedirecting()
{
$messageFactory = new MessageFactory();

$customHeaders = [
$customHeaders = array(
'Content-Type' => 'text/html; charset=utf-8',
'Content-Length' => '111',
];
);

$requestWithCustomHeaders = $messageFactory->request('GET', 'http://example.com', $customHeaders);
$sender = $this->makeSenderMock();

// mock sender to resolve promise with the given $redirectResponse in
// response to the given $requestWithCustomHeaders
$redirectResponse = $messageFactory->response(1.0, 301, null, ['Location' => 'http://example.com/new']);
$redirectResponse = $messageFactory->response(1.0, 301, null, array('Location' => 'http://example.com/new'));
$sender->expects($this->at(0))->method('send')->willReturn(Promise\resolve($redirectResponse));

// mock sender to resolve promise with the given $okResponse in
Expand All @@ -216,7 +216,7 @@ public function testSomeRequestHeadersShouldBeRemovedWhenRedirecting()
return true;
}))->willReturn(Promise\resolve($okResponse));

$transaction = new Transaction($requestWithCustomHeaders, $sender, [], $messageFactory);
$transaction = new Transaction($requestWithCustomHeaders, $sender, array(), $messageFactory);
$transaction->send();
}

Expand Down

0 comments on commit 315d453

Please sign in to comment.