diff options
author | theres <dmarkiew@CNU3429M9W.nsn-intra.net> | 2014-07-15 09:44:07 +0200 |
---|---|---|
committer | theres <dmarkiew@CNU3429M9W.nsn-intra.net> | 2014-07-15 09:44:07 +0200 |
commit | 090e64bd20a40ed55c79025e611ba2c6a45c80df (patch) | |
tree | b9a284b086b69e057386e11333d7ff15a130834d /test/PCurlTest.php | |
parent | 1884e50d534f9ca82527d06861cb7064fe1d9b40 (diff) | |
download | php.curl-090e64bd20a40ed55c79025e611ba2c6a45c80df.zip php.curl-090e64bd20a40ed55c79025e611ba2c6a45c80df.tar.gz php.curl-090e64bd20a40ed55c79025e611ba2c6a45c80df.tar.bz2 |
PCurl will now return PCurlResponse object instead of raw body. PJsonCurl
also, but will try to parse JSON and throw an exception when fail to
parse.
Diffstat (limited to 'test/PCurlTest.php')
-rw-r--r-- | test/PCurlTest.php | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/test/PCurlTest.php b/test/PCurlTest.php index 841603a..566ad0f 100644 --- a/test/PCurlTest.php +++ b/test/PCurlTest.php @@ -6,39 +6,38 @@ use PurpleCode\PCurl\PCurl; class PCurlTest extends PHPUnit_Framework_TestCase {
- private function getCACertBundlePath() {
- return __DIR__.'\ca-cert.crt';
- }
+ private function getCACertBundlePath() {
+ return __DIR__.'\ca-cert.crt';
+ }
public function testShouldGetGooglePageViaHttp() {
// given
- $cut = new PCurl('http://www.google.pl');
+ $cut = new PCurl('http://www.google.pl');
// when
$response = $cut->get('/');
-
// then
- $this->assertSelectRegExp('title', '/Google/', 1, $response);
+ $this->assertSelectRegExp('title', '/Google/', 1, $response->getBody());
}
- public function testShouldGetGooglePageAndCheckHttpsCertificate() {
+ public function testShouldGetGooglePageAndCheckHttpsCertificate() {
// given
- $cut = new PCurl('https://www.google.pl');
- $cut->useSSLCertificate($this->getCACertBundlePath());
+ $cut = new PCurl('https://www.google.pl');
+ $cut->useSSLCertificate($this->getCACertBundlePath());
// when
$response = $cut->get('/');
// then
- $this->assertSelectRegExp('title', '/Google/', 1, $response);
- }
+ $this->assertSelectRegExp('title', '/Google/', 1, $response->getBody());
+ }
public function testShouldGetGooglePageAndThrowExceptionOnMissingCertificate() {
// given
$cut = new PCurl('https://www.google.com');
- // then
- $this->setExpectedException('PurpleCode\PCurl\PCurlException');
+ // then
+ $this->setExpectedException('PurpleCode\PCurl\PCurlException');
// when
$response = $cut->get('/');
|