| Conditions | 3 |
| Paths | 4 |
| Total Lines | 28 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | public function testSomething() |
||
| 22 | { |
||
| 23 | $agent = new Agent(10); |
||
| 24 | |||
| 25 | $called = 0; |
||
| 26 | |||
| 27 | $agent->addListener(function(RequestInterface $req) use (&$called) { |
||
| 28 | $this->assertInstanceOf('CurlX\RequestInterface', $req); |
||
| 29 | $called++; |
||
| 30 | }); |
||
| 31 | |||
| 32 | $r = []; |
||
| 33 | $agent->url = 'http://jsonplaceholder.typeicode.com/posts/1'; |
||
| 34 | |||
| 35 | for($i = 0; $i<20; $i++) { |
||
| 36 | $r[] = $agent->newRequest(); |
||
| 37 | } |
||
| 38 | |||
| 39 | $agent->execute(); |
||
| 40 | |||
| 41 | $this->assertEquals(20, $called); |
||
| 42 | foreach($r as $req) { |
||
| 43 | $this->assertNotNull($req->response); |
||
| 44 | } |
||
| 45 | |||
| 46 | var_dump($r[19]->response); |
||
|
|
|||
| 47 | var_dump($r[19]->url); |
||
| 48 | } |
||
| 49 | } |