tests++
[m6w6/ext-http] / tests / clientpool002.phpt
1 --TEST--
2 pool iteration
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 ?>
7 --FILE--
8 <?php
9 echo "Test\n";
10
11 use http\Client;
12 use http\Curl;
13
14 class UserPool extends Client\Pool\AbstractPool {
15 }
16 class UserClient extends Client\AbstractClient {
17 function send($request = null) {
18 }
19 }
20
21 echo "CURL\n";
22
23 $client = new Curl\Client();
24 $pool = new Curl\Client\Pool();
25
26 echo "Iterator: ";
27 foreach ($pool as $c) {
28 if ($c !== $client) {
29 echo ".";
30 }
31 }
32 echo "\n";
33 echo "Attached: ";
34 foreach ($pool->getAttached() as $c) {
35 if ($c !== $client) {
36 echo ".";
37 }
38 }
39 echo "\n";
40 echo "Finished: ";
41 foreach ($pool->getFinished() as $c) {
42 echo ".";
43 }
44 echo "\n";
45
46 echo "USER\n";
47
48 $client = new UserClient();
49 $pool = new UserPool();
50
51 echo "Iterator: ";
52 foreach ($pool as $c) {
53 if ($c !== $client) {
54 echo ".";
55 }
56 }
57 echo "\n";
58 echo "Attached: ";
59 foreach ($pool->getAttached() as $c) {
60 if ($c !== $client) {
61 echo ".";
62 }
63 }
64 echo "\n";
65 echo "Finished: ";
66 foreach ($pool->getFinished() as $c) {
67 echo ".";
68 }
69 echo "\n";
70 ?>
71 Done
72 --EXPECT--
73 Test
74 CURL
75 Iterator:
76 Attached:
77 Finished:
78 USER
79 Iterator:
80 Attached:
81 Finished:
82 Done