scratch – Blame information for rev 87
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | <?php |
2 | |||
3 | namespace GuzzleHttp\Tests\Event; |
||
4 | |||
5 | use GuzzleHttp\Adapter\Transaction; |
||
6 | use GuzzleHttp\Client; |
||
7 | use GuzzleHttp\Event\BeforeEvent; |
||
8 | use GuzzleHttp\Message\Request; |
||
9 | use GuzzleHttp\Message\Response; |
||
10 | |||
11 | /** |
||
12 | * @covers GuzzleHttp\Event\BeforeEvent |
||
13 | */ |
||
14 | class BeforeEventTest extends \PHPUnit_Framework_TestCase |
||
15 | { |
||
16 | public function testInterceptsWithEvent() |
||
17 | { |
||
18 | $response = new Response(200); |
||
19 | $res = null; |
||
20 | $t = new Transaction(new Client(), new Request('GET', '/')); |
||
21 | $t->getRequest()->getEmitter()->on('complete', function ($e) use (&$res) { |
||
22 | $res = $e; |
||
23 | }); |
||
24 | $e = new BeforeEvent($t); |
||
25 | $e->intercept($response); |
||
26 | $this->assertTrue($e->isPropagationStopped()); |
||
27 | $this->assertSame($res->getClient(), $e->getClient()); |
||
28 | } |
||
29 | } |