77use Http \Promise \RejectedPromise ;
88use Psr \Http \Message \RequestInterface ;
99use Psr \Http \Message \ResponseInterface ;
10+ use Psr \Http \Message \StreamInterface ;
11+ use Psr \Http \Message \UriInterface ;
1012use Symfony \Component \Stopwatch \Stopwatch ;
1113use PhpSpec \ObjectBehavior ;
1214
@@ -27,13 +29,14 @@ function it_is_a_plugin()
2729 $ this ->shouldImplement ('Http\Client\Common\Plugin ' );
2830 }
2931
30- function it_records_event (Stopwatch $ stopwatch , RequestInterface $ request , ResponseInterface $ response )
32+ function it_records_event (Stopwatch $ stopwatch , RequestInterface $ request , ResponseInterface $ response, UriInterface $ uri )
3133 {
3234 $ request ->getMethod ()->willReturn ('GET ' );
33- $ request ->getRequestTarget ()->willReturn ('/ ' );
35+ $ request ->getUri ()->willReturn ($ uri );
36+ $ uri ->__toString ()->willReturn ('http://foo.com/bar ' );
3437
35- $ stopwatch ->start ('GET / ' , 'php_http.request ' )->shouldBeCalled ();
36- $ stopwatch ->stop ('GET / ' , 'php_http.request ' )->shouldBeCalled ();
38+ $ stopwatch ->start ('GET http://foo.com/bar ' , 'php_http.request ' )->shouldBeCalled ();
39+ $ stopwatch ->stop ('GET http://foo.com/bar ' , 'php_http.request ' )->shouldBeCalled ();
3740
3841 $ next = function (RequestInterface $ request ) use ($ response ) {
3942 return new FulfilledPromise ($ response ->getWrappedObject ());
@@ -42,13 +45,14 @@ function it_records_event(Stopwatch $stopwatch, RequestInterface $request, Respo
4245 $ this ->handleRequest ($ request , $ next , function () {});
4346 }
4447
45- function it_records_event_on_error (Stopwatch $ stopwatch , RequestInterface $ request )
48+ function it_records_event_on_error (Stopwatch $ stopwatch , RequestInterface $ request, UriInterface $ uri )
4649 {
4750 $ request ->getMethod ()->willReturn ('GET ' );
48- $ request ->getRequestTarget ()->willReturn ('/ ' );
51+ $ request ->getUri ()->willReturn ($ uri );
52+ $ uri ->__toString ()->willReturn ('http://foo.com/bar ' );
4953
50- $ stopwatch ->start ('GET / ' , 'php_http.request ' )->shouldBeCalled ();
51- $ stopwatch ->stop ('GET / ' , 'php_http.request ' )->shouldBeCalled ();
54+ $ stopwatch ->start ('GET http://foo.com/bar ' , 'php_http.request ' )->shouldBeCalled ();
55+ $ stopwatch ->stop ('GET http://foo.com/bar ' , 'php_http.request ' )->shouldBeCalled ();
5256
5357 $ next = function (RequestInterface $ request ) {
5458 return new RejectedPromise (new NetworkException ('' , $ request ));
0 commit comments