|
@@ -308,4 +308,27 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|
$this->assertInstanceof('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
|
|
$this->assertInstanceof('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function testGetServerParameter()
|
|
|
|
+ {
|
|
|
|
+ $client = new TestClient();
|
|
|
|
+ $this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST'));
|
|
|
|
+ $this->assertEquals('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3', $client->getServerParameter('HTTP_USER_AGENT'));
|
|
|
|
+
|
|
|
|
+ $this->assertEquals('testvalue', $client->getServerParameter('testkey', 'testvalue'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function testSetServerParameter()
|
|
|
|
+ {
|
|
|
|
+ $client = new TestClient();
|
|
|
|
+
|
|
|
|
+ $this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST'));
|
|
|
|
+ $this->assertEquals('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3', $client->getServerParameter('HTTP_USER_AGENT'));
|
|
|
|
+
|
|
|
|
+ $client->setServerParameter('HTTP_HOST', 'testhost');
|
|
|
|
+ $this->assertEquals('testhost', $client->getServerParameter('HTTP_HOST'));
|
|
|
|
+
|
|
|
|
+ $client->setServerParameter('HTTP_USER_AGENT', 'testua');
|
|
|
|
+ $this->assertEquals('testua', $client->getServerParameter('HTTP_USER_AGENT'));
|
|
|
|
+ }
|
|
}
|
|
}
|