summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpurplecode <niespammnie@gmail.com>2013-12-05 11:20:14 +0100
committerpurplecode <niespammnie@gmail.com>2013-12-05 11:20:14 +0100
commitc4f9330d8609a9474cfe5f48b0a5d1655b812044 (patch)
tree1c836b7c267460a0ba0b80d5988199b4f69628f4
parent8af62be1a514f322f432076ae0e11390f1907457 (diff)
downloadphp.curl-c4f9330d8609a9474cfe5f48b0a5d1655b812044.zip
php.curl-c4f9330d8609a9474cfe5f48b0a5d1655b812044.tar.gz
php.curl-c4f9330d8609a9474cfe5f48b0a5d1655b812044.tar.bz2
sample test
-rw-r--r--src/PCurl.php6
-rw-r--r--src/PCurlException.php7
-rw-r--r--test/PCurlTest.php20
3 files changed, 29 insertions, 4 deletions
diff --git a/src/PCurl.php b/src/PCurl.php
index 27a87f8..301da54 100644
--- a/src/PCurl.php
+++ b/src/PCurl.php
@@ -1,5 +1,11 @@
<?php
+namespace PurpleCode;
+
+require_once 'PCurlException.php';
+
+use PurpleCode\PCurlException;
+
class PCurl {
private $options;
diff --git a/src/PCurlException.php b/src/PCurlException.php
index 04819f5..3c4580d 100644
--- a/src/PCurlException.php
+++ b/src/PCurlException.php
@@ -1,9 +1,8 @@
<?php
-namespace Nsn\NetEng\CommonBundle\Exceptions;
+namespace PurpleCode;
-
-class MintException extends \Exception {
+class PCurlException extends \Exception {
public static function getClassName() {
return get_called_class();
@@ -19,7 +18,7 @@ class MintException extends \Exception {
}
}
- public function __construct($message = "Exception", $code = 400 $previous = null) {
+ public function __construct($message = "Exception", $code = 400, $previous = null) {
parent::__construct($message, $code, $previous);
}
diff --git a/test/PCurlTest.php b/test/PCurlTest.php
new file mode 100644
index 0000000..08d191a
--- /dev/null
+++ b/test/PCurlTest.php
@@ -0,0 +1,20 @@
+<?php
+
+require_once (dirname(__FILE__) . '/../src/PCurl.php');
+
+use PurpleCode\PCurl;
+
+class PCurlTest extends PHPUnit_Framework_TestCase {
+
+ public function testShouldGetGooglePage() {
+ // given
+ $cut = new PCurl('https://www.google.com');
+
+ // when
+ $response = $cut->get('/');
+
+ // then
+ $this->assertSelectRegExp('title', '/Google/', 1, $response);
+ }
+
+} \ No newline at end of file