safety guards for objects which di not set the intern pointer automatically
[m6w6/ext-http] / phpunit / DataShareTest.php
index 0a5072780f5c9f26843defce1c2b95a63c63ffad..6518ce129e771ecd04664bcdc0bb38a63bd9644d 100644 (file)
@@ -1,5 +1,11 @@
 <?php
 
+class UserClient extends http\Client\AbstractClient {
+       function send($request = null) {
+       }
+}
+       
+
 class DataShareTest extends PHPUnit_Framework_TestCase
 {
     function testStandard() {
@@ -38,7 +44,7 @@ class DataShareTest extends PHPUnit_Framework_TestCase
     }
     
     function testCurl() {
-       $client = new http\Curl\Client;
+       $client = new http\Curl\Client(array("connecttimeout" => 10));
        $client->setRequest(new http\Client\Request("GET", "https://twitter.com/"));
        $share = new http\Curl\Client\DataShare;
        $share->ssl = $share->dns = $share->cookie = true;
@@ -54,5 +60,16 @@ class DataShareTest extends PHPUnit_Framework_TestCase
        $share->detach($client);
        $share->reset();
     }
+    
+    function testCurlIncompatible() {
+       $client = new UserClient;
+       $client->setRequest(new http\Client\Request("GET", "https://twitter.com"));
+
+       $share = new http\Curl\Client\DataShare;
+               $this->setExpectedException("PHPUnit_Framework_Error_Warning");
+       $share->attach($client);
+               $this->setExpectedException("PHPUnit_Framework_Error_Warning");
+       $share->detach($client);
+    }
 }