diff options
author | purplecode <niespammnie@gmail.com> | 2014-12-24 12:20:42 +0100 |
---|---|---|
committer | purplecode <niespammnie@gmail.com> | 2014-12-24 12:20:42 +0100 |
commit | ffd2008900b34c003e99e09d710586e0435f5af6 (patch) | |
tree | 56be804884177a9e6696d566390eb9c2c6bfb5e7 /test/PCurlTest.php | |
parent | a3b4c26df66605c76c5893dc1aee2d578b474aed (diff) | |
download | php.curl-ffd2008900b34c003e99e09d710586e0435f5af6.zip php.curl-ffd2008900b34c003e99e09d710586e0435f5af6.tar.gz php.curl-ffd2008900b34c003e99e09d710586e0435f5af6.tar.bz2 |
json, object response changes + test fixes
Diffstat (limited to 'test/PCurlTest.php')
-rw-r--r-- | test/PCurlTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/PCurlTest.php b/test/PCurlTest.php index 566ad0f..d05f72d 100644 --- a/test/PCurlTest.php +++ b/test/PCurlTest.php @@ -16,8 +16,10 @@ class PCurlTest extends PHPUnit_Framework_TestCase { // when
$response = $cut->get('/');
+
// then
$this->assertSelectRegExp('title', '/Google/', 1, $response->getBody());
+ $this->assertEquals(200, $response->getHttpCode());
}
public function testShouldGetGooglePageAndCheckHttpsCertificate() {
@@ -43,4 +45,30 @@ class PCurlTest extends PHPUnit_Framework_TestCase { $response = $cut->get('/');
}
+ public function testShouldSetProperResponseCodeOnBadRequest() {
+ // given
+ $cut = new PCurl('http://www.google.com/pcurlnotfound');
+
+ // then
+ //$this->setExpectedException('PurpleCode\PCurl\PCurlException');
+
+ // when
+ $response = $cut->get('/');
+
+ // then
+ $this->assertEquals(404, $response->getHttpCode());
+ }
+
+ public function testShouldRaiseErrorOnSuccessAssertion() {
+ // given
+ $cut = new PCurl('http://www.google.com/pcurlnotfound');
+
+ // then
+ $this->setExpectedException('PurpleCode\PCurl\PCurlException');
+
+ // when
+ $response = $cut->get('/')->assertSuccess();
+ }
+
+
}
\ No newline at end of file |