add test for client's once & wait with events
authorMichael Wallner <mike@php.net>
Tue, 9 Sep 2014 07:24:08 +0000 (09:24 +0200)
committerMichael Wallner <mike@php.net>
Tue, 9 Sep 2014 07:24:08 +0000 (09:24 +0200)
package.xml
tests/client016.phpt [new file with mode: 0644]

index a4e1b4e..528ca8a 100644 (file)
@@ -151,6 +151,7 @@ v2: http://dev.iworks.at/ext-http/lcov/ext/http/
      <file role="test" name="client012.phpt"/>
      <file role="test" name="client013.phpt"/>
      <file role="test" name="client014.phpt"/>
+     <file role="test" name="client015.phpt"/>
      <file role="test" name="clientrequest001.phpt"/>
      <file role="test" name="clientrequest002.phpt"/>
      <file role="test" name="clientrequest003.phpt"/>
diff --git a/tests/client016.phpt b/tests/client016.phpt
new file mode 100644 (file)
index 0000000..f50d9bb
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+client once & wait with events
+--SKIPIF--
+<?php
+include "skipif.inc";
+try {
+       $client = new http\Client;
+       if (!$client->enableEvents())
+               throw new Exception("need events support");
+} catch (Exception $e) {
+       die("skip ".$e->getMessage());
+}
+skip_online_test();
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$request = new http\Client\Request("GET", "http://www.example.org/");
+
+foreach (http\Client::getAvailableDrivers() as $driver) {
+       $client = new http\Client($driver);
+       $client->enableEvents(true);
+       $client->enqueue($request);
+       
+       while ($client->once()) {
+               $client->wait(.1);
+       }
+       
+       if (!$client->getResponse()) {
+               var_dump($client);
+       }
+}
+?>
+Done
+--EXPECT--
+Test
+Done