PATH:
opt
/
alt
/
tests
/
alt-php53-pecl-http_2.6.0-1.el8
/
tests
--TEST-- client curl user handler --SKIPIF-- <?php include "skipif.inc"; skip_client_test(); _ext("ev"); ?> --FILE-- <?php echo "Test\n"; class UserHandler implements http\Client\Curl\User { private $client; private $run; private $ios = []; private $timeout; function __construct(http\Client $client) { $this->client = $client; } function init($run) { $this->run = $run; } function timer($timeout_ms) { echo "T"; if (isset($this->timeout)) { $this->timeout->set($timeout_ms/1000, 0); $this->timeout->start(); } else { $this->timeout = new EvTimer($timeout_ms/1000, 0, function() { if (!call_user_func($this->run, $this->client)) { if ($this->timeout) { $this->timeout->stop(); $this->timeout = null; } } }); } } function socket($socket, $action) { echo "S"; switch ($action) { case self::POLL_NONE: break; case self::POLL_REMOVE: if (isset($this->ios[(int) $socket])) { echo "U"; $this->ios[(int) $socket]->stop(); unset($this->ios[(int) $socket]); } break; default: $ev = 0; if ($action & self::POLL_IN) { $ev |= Ev::READ; } if ($action & self::POLL_OUT) { $ev |= Ev::WRITE; } if (isset($this->ios[(int) $socket])) { $this->ios[(int) $socket]->set($socket, $ev); } else { $this->ios[(int) $socket] = new EvIo($socket, $ev, function($watcher, $events) use($socket) { $action = 0; if ($events & Ev::READ) { $action |= self::POLL_IN; } if ($events & Ev::WRITE) { $action |= self::POLL_OUT; } if (!call_user_func($this->run, $this->client, $socket, $action)) { if ($this->timeout) { $this->timeout->stop(); $this->timeout = null; } } }); } break; } } function once() { throw new BadMethodCallException("this test uses Ev::run()"); } function wait($timeout_ms = null) { throw new BadMethodCallException("this test uses Ev::run()"); } function send() { throw new BadMethodCallException("this test uses Ev::run()"); } } include "helper/server.inc"; server("proxy.inc", function($port) { $client = new http\Client; $client->configure([ "use_eventloop" => new UserHandler($client) ]); $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/"), function($r) { var_dump($r->getResponseCode()); }); Ev::run(); }); ?> ===DONE=== --EXPECTREGEX-- Test T[ST]+U+int\(200\) ===DONE===
[+]
..
[-] message003.phpt
[edit]
[-] header009.phpt
[edit]
[-] message011.phpt
[edit]
[-] headerparser003.phpt
[edit]
[-] client019.phpt
[edit]
[-] client014.phpt
[edit]
[-] etag001.phpt
[edit]
[-] urlparser011.phpt
[edit]
[-] urlparser010.phpt
[edit]
[-] urlparser006.phpt
[edit]
[-] bug69076.phpt
[edit]
[-] client010.phpt
[edit]
[-] headerparser002.phpt
[edit]
[-] bug69000.phpt
[edit]
[-] filterchunked.phpt
[edit]
[-] messagebody008.phpt
[edit]
[-] cookie011.phpt
[edit]
[-] client003.phpt
[edit]
[+]
data
[-] messagebody010.phpt
[edit]
[-] message009.phpt
[edit]
[-] client012.phpt
[edit]
[-] messagebody004.phpt
[edit]
[+]
helper
[-] messagebody001.phpt
[edit]
[-] message006.phpt
[edit]
[-] client009.phpt
[edit]
[-] header007.phpt
[edit]
[-] clientresponse003.phpt
[edit]
[-] cookie009.phpt
[edit]
[-] cookie010.phpt
[edit]
[-] info001.phpt
[edit]
[-] phpinfo.phpt
[edit]
[-] params013.phpt
[edit]
[-] propertyproxy001.phpt
[edit]
[-] messagebody009.phpt
[edit]
[-] bug61444.phpt
[edit]
[-] urlparser007.phpt
[edit]
[-] header004.phpt
[edit]
[-] params012.phpt
[edit]
[-] message001.phpt
[edit]
[-] querystring003.phpt
[edit]
[-] client024.phpt
[edit]
[-] params005.phpt
[edit]
[-] serialize001.phpt
[edit]
[-] cookie008.phpt
[edit]
[-] gh-issue6.phpt
[edit]
[-] clientrequest004.phpt
[edit]
[-] urlparser004.phpt
[edit]
[-] params014.phpt
[edit]
[-] cookie003.phpt
[edit]
[-] url003.phpt
[edit]
[-] cookie012.phpt
[edit]
[-] info002.phpt
[edit]
[-] cookie006.phpt
[edit]
[-] messagebody005.phpt
[edit]
[-] messagebody006.phpt
[edit]
[-] url004.phpt
[edit]
[-] client029.phpt
[edit]
[-] client026.phpt
[edit]
[-] bug71719.phpt
[edit]
[-] bug67932.phpt
[edit]
[-] header008.phpt
[edit]
[-] urlparser005.phpt
[edit]
[-] params010.phpt
[edit]
[-] params002.phpt
[edit]
[-] client023.phpt
[edit]
[-] header003.phpt
[edit]
[-] params008.phpt
[edit]
[-] clientrequest001.phpt
[edit]
[-] client005.phpt
[edit]
[-] message015.phpt
[edit]
[-] urlparser001.phpt
[edit]
[-] client020.phpt
[edit]
[-] bug69357.phpt
[edit]
[-] header002.phpt
[edit]
[-] urlparser008.phpt
[edit]
[-] message007.phpt
[edit]
[-] bug69313.phpt
[edit]
[-] cookie004.phpt
[edit]
[-] url001.phpt
[edit]
[-] message012.phpt
[edit]
[-] clientresponse002.phpt
[edit]
[-] cookie002.phpt
[edit]
[-] cookie005.phpt
[edit]
[-] bug66388.phpt
[edit]
[-] header006.phpt
[edit]
[-] querystring001.phpt
[edit]
[-] message005.phpt
[edit]
[-] clientrequest002.phpt
[edit]
[-] message013.phpt
[edit]
[-] cookie007.phpt
[edit]
[-] params011.phpt
[edit]
[-] gh-issue42.phpt
[edit]
[-] params004.phpt
[edit]
[-] params015.phpt
[edit]
[-] client013.phpt
[edit]
[-] client001.phpt
[edit]
[-] client006.phpt
[edit]
[-] urlparser009.phpt
[edit]
[-] client004.phpt
[edit]
[-] header005.phpt
[edit]
[-] bug73055.phpt
[edit]
[-] params001.phpt
[edit]
[-] gh-issue50.phpt
[edit]
[-] params009.phpt
[edit]
[-] message016.phpt
[edit]
[-] cookie001.phpt
[edit]
[-] messagebody002.phpt
[edit]
[-] params003.phpt
[edit]
[-] client011.phpt
[edit]
[-] client025.phpt
[edit]
[-] urlparser003.phpt
[edit]
[-] clientrequest003.phpt
[edit]
[-] message010.phpt
[edit]
[-] client007.phpt
[edit]
[-] messageparser002.phpt
[edit]
[-] headerparser001.phpt
[edit]
[-] params007.phpt
[edit]
[-] client022.phpt
[edit]
[-] version001.phpt
[edit]
[-] messagebody003.phpt
[edit]
[-] params017.phpt
[edit]
[-] messagebody007.phpt
[edit]
[-] params016.phpt
[edit]
[-] urlparser002.phpt
[edit]
[-] params006.phpt
[edit]
[-] message004.phpt
[edit]
[-] client017.phpt
[edit]
[-] client002.phpt
[edit]
[-] url002.phpt
[edit]
[-] header001.phpt
[edit]
[-] querystring002.phpt
[edit]
[-] skipif.inc
[edit]
[-] clientresponse001.phpt
[edit]
[-] messageparser001.phpt
[edit]
[-] url005.phpt
[edit]
[-] message014.phpt
[edit]