Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing13/http #1576

Merged
merged 3 commits into from
Dec 3, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Response testing completed
  • Loading branch information
jim-parry committed Dec 3, 2018
commit 4a454831f8f75d22b1dbe0a5b0576d5a9ee75e57
26 changes: 20 additions & 6 deletions tests/system/HTTP/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,21 @@ public function testSetLink()
$response->setLink($pager);

$this->assertEquals(
'<http://example.com?page=1>; rel="first",<http://example.com?page=2>; rel="prev",<http://example.com?page=4>; rel="next",<http://example.com?page=20>; rel="last"',
$response->getHeader('Link')->getValue()
'<http://example.com?page=1>; rel="first",<http://example.com?page=2>; rel="prev",<http://example.com?page=4>; rel="next",<http://example.com?page=20>; rel="last"', $response->getHeader('Link')->getValue()
);

$pager->store('default', 1, 10, 200);
$response->setLink($pager);

$this->assertEquals(
'<http://example.com?page=2>; rel="next",<http://example.com?page=20>; rel="last"',
$response->getHeader('Link')->getValue()
'<http://example.com?page=2>; rel="next",<http://example.com?page=20>; rel="last"', $response->getHeader('Link')->getValue()
);

$pager->store('default', 20, 10, 200);
$response->setLink($pager);

$this->assertEquals(
'<http://example.com?page=1>; rel="first",<http://example.com?page=19>; rel="prev"',
$response->getHeader('Link')->getValue()
'<http://example.com?page=1>; rel="first",<http://example.com?page=19>; rel="prev"', $response->getHeader('Link')->getValue()
);
}

Expand Down Expand Up @@ -529,4 +526,21 @@ public function testRedirectResponseCookies()
$this->assertTrue($answer1->hasCookie('login_time'));
}

//--------------------------------------------------------------------
// Make sure we don't blow up if pretending to send headers
public function testPretendOutput()
{
$response = new Response(new App());
$response->pretend(true);

$response->setBody('Happy days');

ob_start();
$response->send();
$actual = ob_get_contents();
ob_end_clean();

$this->assertEquals('Happy days', $actual);
}

}