1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-11-30 04:19:49 +01:00
ext-pq/tests/async001.phpt

50 lines
861 B
Plaintext
Raw Permalink Normal View History

2013-01-21 17:44:37 +01:00
--TEST--
async connect
--SKIPIF--
<?php include "_skipif.inc"; ?>
--FILE--
<?php
echo "Test\n";
include "_setup.inc";
2013-01-21 17:58:33 +01:00
$c = new pq\Connection(PQ_DSN, true);
2013-01-21 17:44:37 +01:00
$s = array($c->status);
echo "W";
$w = array($c->socket);
$r = $e = null;
stream_select($r, $w, $e, null);
while (true) {
$s[] = $c->status;
echo "P";
switch ($c->poll()) {
case pq\Connection::POLLING_READING:
echo "R";
$w = $e = null;
$r = array($c->socket);
stream_select($r, $w, $e, NULL);
break;
case pq\Connection::POLLING_WRITING:
echo "W";
$w = array($c->socket);
$r = $e = null;
stream_select($r, $w, $e, null);
break;
case pq\Connection::POLLING_FAILED:
echo "F";
break 2;
case pq\Connection::POLLING_OK:
echo "S";
break 2;
}
}
2015-08-17 16:57:23 +02:00
$s[] = $c->status;
2013-01-21 17:44:37 +01:00
printf("\n%s\n", implode(",", $s));
?>
DONE
--EXPECTREGEX--
Test
(WP(RP)*)+S
2(,\d*)*,0
2013-01-21 17:44:37 +01:00
DONE