public function testInterceptsWithEvent() { $t = new Transaction(new Client(), new Request('GET', '/')); $t->exception = new \Exception('foo'); $e = new BeforeEvent($t); $response = new Response(200); $e->intercept($response); $this->assertTrue($e->isPropagationStopped()); $this->assertSame($t->response, $response); $this->assertNull($t->exception); }
public function testInterceptsWithEvent() { $response = new Response(200); $res = null; $t = new Transaction(new Client(), new Request('GET', '/')); $t->getRequest()->getEmitter()->on('complete', function ($e) use(&$res) { $res = $e; }); $e = new BeforeEvent($t); $e->intercept($response); $this->assertTrue($e->isPropagationStopped()); $this->assertSame($res->getClient(), $e->getClient()); }