X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2Ffactory.phpt;h=64969132757aa4be3b54f3aaddaa5e6b2cd0d76f;hp=f28eda77c498070fdea5bb8539b5ca3bfc821866;hb=d5de4f9eae86ae1dab0f8a906bf9543710ae124d;hpb=fa54d3dd8c0f101c9f8619d59eaf1940c311e7e5 diff --git a/tests/factory.phpt b/tests/factory.phpt index f28eda7..6496913 100644 --- a/tests/factory.phpt +++ b/tests/factory.phpt @@ -3,45 +3,69 @@ factory --SKIPIF-- --FILE-- "curl")); -$r = $f->createRequest(); +$r = $f->createClient(); $p = $f->createPool(); $s = $f->createDataShare(); -var_dump(array_map("get_class", array($f,$r,$p,$s))); +$r->setRequest(new http\Client\Request("GET", "http://localhost/")); +$x = $f->createPool($r); +$y = $f->createDatashare($r); + +var_dump( + array_map("get_class", array($f,$r,$p,$s,$x,$y)), + $f->getDriver() +); + +foreach (array("Client", "Pool", "DataShare") as $type) { + try { + $f = new http\Client\Factory(array("driver" => "nonexistant")); + var_dump($f->{"create$type"}()); + } catch (Exception $e) { + echo $e->getMessage(), "\n"; + } +} echo "Done\n"; ?> --EXPECTF-- Test -array(4) { +array(6) { [0]=> string(9) "MyFactory" [1]=> - string(9) "MyRequest" + string(8) "MyClient" [2]=> string(6) "MyPool" [3]=> string(7) "MyShare" + [4]=> + string(6) "MyPool" + [5]=> + string(7) "MyShare" } +string(4) "curl" +clients are not supported by this driver +pools are not supported by this driver +datashares are not supported by this driver Done