@@ -53,7 +53,15 @@ public function testHandle()
53
53
* Third request.
54
54
*/
55
55
$ thirdRequest = new Request ('GET ' , 'https://api.example.com/2 ' );
56
- $ client ->request ($ thirdRequest , Argument::type ('array ' ))->shouldNotBeCalled ();
56
+ $ thirdBody = [];
57
+ $ thirdStream = new JsonStream ($ thirdBody );
58
+ $ thirdHeaders = [
59
+ 'Link ' => [
60
+ '<https://api.example.com/1>; rel="prev" ' ,
61
+ ],
62
+ ];
63
+ $ thirdResponse = new Response (200 , $ thirdHeaders , $ thirdStream );
64
+ $ client ->request ($ thirdRequest , Argument::type ('array ' ))->shouldBeCalled ()->willReturn (resolve ($ thirdResponse ));
57
65
58
66
$ requestService = new RequestService ($ client ->reveal ());
59
67
$ testScheduler = new TestScheduler ();
@@ -62,8 +70,8 @@ public function testHandle()
62
70
$ items = [];
63
71
$ completed = false ;
64
72
65
- $ stream = $ iteratePagesService ->iterate ($ path)-> take ( 2 )->subscribe (
66
- function ($ item ) use (&$ items, & $ stream ) {
73
+ $ iteratePagesService ->iterate ($ path )->subscribe (
74
+ function ($ item ) use (&$ items ) {
67
75
$ items [] = $ item ;
68
76
},
69
77
function ($ t ) {
@@ -77,6 +85,6 @@ function () use (&$completed) {
77
85
$ testScheduler ->start ();
78
86
79
87
self ::assertTrue ($ completed );
80
- self ::assertSame ([$ firstBody , $ secondBody ], $ items );
88
+ self ::assertSame ([$ firstBody , $ secondBody, $ thirdBody ], $ items );
81
89
}
82
90
}
0 commit comments