fix wrong assumption in php_http_env_is_response_cached_by_*
[m6w6/ext-http] / tests / factory.phpt
index f28eda77c498070fdea5bb8539b5ca3bfc821866..d80bc82ef43afaaa2cf0d5a78ab38f80114d1c4c 100644 (file)
@@ -3,17 +3,17 @@ factory
 --SKIPIF--
 <?php
 include "skipif.inc";
-in_array("curl", http\request\Factory::getAvailableDrivers()) or die ("skip CURL support missing");
+in_array("curl", http\Request\Factory::getAvailableDrivers()) or die ("skip CURL support missing");
 ?>
 --FILE--
 <?php
 echo "Test\n";
 
 class MyRequest extends http\Request {}
-class MyPool extends http\request\Pool {}
-class MyShare extends http\request\DataShare {}
+class MyPool extends http\Request\Pool {}
+class MyShare extends http\Request\DataShare {}
   
-class MyFactory extends http\request\Factory {
+class MyFactory extends http\Request\Factory {
        protected $driver = "curl";
        protected $persistentHandleId = "My";
        protected $requestClass = "MyRequest";
@@ -28,7 +28,18 @@ $r = $f->createRequest();
 $p = $f->createPool();
 $s = $f->createDataShare();
 
-var_dump(array_map("get_class", array($f,$r,$p,$s)));
+var_dump(
+       array_map("get_class", array($f,$r,$p,$s)), 
+       $f->getDriver()
+);
+
+foreach (array("Request", "Pool", "DataShare") as $type) {
+       try {
+               var_dump((new http\Request\Factory(array("driver" => "nonexistant")))->{"create$type"}());
+       } catch (Exception $e) {
+               echo $e->getMessage(), "\n";
+       }
+}
 
 echo "Done\n";
 ?>
@@ -44,4 +55,8 @@ array(4) {
   [3]=>
   string(7) "MyShare"
 }
+string(4) "curl"
+requests are not supported by this driver
+pools are not supported by this driver
+datashares are not supported by this driver
 Done