Skip to content

Commit

Permalink
Use the right Net_URL2 methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel O'Connor committed Jan 11, 2012
1 parent c8c0a32 commit 3f5101b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/HTTP_Header2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@ function testsendHeaders()

function testsendStatusCode()
{
$r = new HTTP_Request2($this->testScript);
$url = new Net_URL2($this->testScript);
$r = new HTTP_Request2($url);

$r->setMethod(HTTP_Request2::METHOD_GET);
$response = $r->send();
$this->assertEquals(200, $response->getStatus(), 'test for response code 200');
$r->addQueryString('status', 500);

$url->setQueryVariable('status', '500');

$response = $r->send();
$this->assertEquals(500, $response->getStatus(), 'test for response code 500');
unset($h, $r);
Expand All @@ -108,9 +112,10 @@ function testdateToTimestamp()

function testredirect()
{
$r = new HTTP_Request2($this->testScript, array('allowRedirects' => false));
$url = new Net_URL2($this->testScript);
$url->setQueryVariable('redirect', 'response.php?abc=123');
$r = new HTTP_Request2($url, array('allowRedirects' => false));
$r->setMethod(HTTP_Request2::METHOD_GET);
$r->addQueryString('redirect', 'response.php?abc=123');
$response = $r->send();
$this->assertEquals(302, $response->getStatus(), 'test for response code 302');
$this->assertTrue(strstr($response->getHeader('location'), 'response.php'));
Expand Down

0 comments on commit 3f5101b

Please sign in to comment.