Permalink
Browse files

Update unit tests

  • Loading branch information...
1 parent 8932a14 commit d04cbc4374e93f6a6e493c912877d005a676be72 @shuber committed Sep 7, 2009
Showing with 21 additions and 2 deletions.
  1. +8 −0 test/test_helper.php
  2. +13 −2 test/unit/curl_test.php
View
@@ -22,6 +22,14 @@ function assert_no_difference($expression, $lambda) {
assert_equal($value, eval($expression));
}
+function assert_empty($value) {
+ ensure(empty($value));
+}
+
+function assert_not_empty($value) {
+ ensure(!empty($value));
+}
+
function assert_in_array($needle, $haystack) {
ensure(in_array($needle, $haystack));
}
View
@@ -2,8 +2,19 @@
class CurlTest extends ztest\UnitTestCase {
- function test_this_lib() {
- fail();
+ function setup() {
+ $this->curl = new Curl;
+ $this->response = $this->curl->get('www.google.com');
+ }
+
+ function test_get() {
+ assert_matches('#google#', $this->response);
+ assert_equal(200, $this->response->headers['Status-Code']);
+ }
+
+ function test_error() {
+ $this->curl->get('diaewkaksdljf-invalid-url-dot-com.com');
+ assert_not_empty($this->curl->error());
}
}

0 comments on commit d04cbc4

Please sign in to comment.