3
namespace GuzzleHttp\Tests\Event;
5
use GuzzleHttp\Adapter\Transaction;
7
use GuzzleHttp\Event\BeforeEvent;
8
use GuzzleHttp\Message\Request;
9
use GuzzleHttp\Message\Response;
12
* @covers GuzzleHttp\Event\BeforeEvent
14
class BeforeEventTest extends \PHPUnit_Framework_TestCase
16
public function testInterceptsWithEvent()
18
$response = new Response(200);
20
$t = new Transaction(new Client(), new Request('GET', '/'));
21
$t->getRequest()->getEmitter()->on('complete', function ($e) use (&$res) {
24
$e = new BeforeEvent($t);
25
$e->intercept($response);
26
$this->assertTrue($e->isPropagationStopped());
27
$this->assertSame($res->getClient(), $e->getClient());