public function testHasEffectiveUrl() { $r = new tubepress_http_impl_puzzle_PuzzleBasedResponse(new puzzle_message_Response(200)); $this->assertNull($r->getEffectiveUrl()); $mockUrl = $this->mock('tubepress_api_url_UrlInterface'); $r->setEffectiveUrl($mockUrl); $this->assertInstanceOf('tubepress_api_url_UrlInterface', $r->getEffectiveUrl()); $r = new puzzle_message_Response(200); $r->setEffectiveUrl('http://bas.foo/sdf'); $r = new tubepress_http_impl_puzzle_PuzzleBasedResponse($r); $this->assertInstanceOf('tubepress_api_url_UrlInterface', $r->getEffectiveUrl()); }
public function testPreventsComplexExternalEntities() { $xml = '<?xml version="1.0"?><!DOCTYPE scan[<!ENTITY test SYSTEM "php://filter/read=convert.base64-encode/resource=ResponseTest.php">]><scan>&test;</scan>'; $response = new puzzle_message_Response(200, array(), puzzle_stream_Stream::factory($xml)); $oldCwd = getcwd(); chdir(dirname(__FILE__)); try { $xml = $response->xml(); chdir($oldCwd); $this->markTestIncomplete('Did not throw the expected exception! XML resolved as: ' . $xml->asXML()); } catch (Exception $e) { chdir($oldCwd); } }
public function testGetsResponseStartLine() { $m = new puzzle_message_Response(200); $this->assertEquals('HTTP/1.1 200 OK', puzzle_message_Response::getStartLine($m)); }