@@ -234,7 +234,7 @@ public function testGetWithAlreadyExistingFileAndOutdatedTimestamp() {
234234 $ this ->timeFactory
235235 ->expects ($ this ->at (0 ))
236236 ->method ('getTime ' )
237- ->willReturn (1501 );
237+ ->willReturn (4801 );
238238 $ client = $ this ->createMock (IClient::class);
239239 $ this ->clientService
240240 ->expects ($ this ->once ())
@@ -244,7 +244,15 @@ public function testGetWithAlreadyExistingFileAndOutdatedTimestamp() {
244244 $ client
245245 ->expects ($ this ->once ())
246246 ->method ('get ' )
247- ->with ($ this ->endpoint )
247+ ->with (
248+ $ this ->equalTo ($ this ->endpoint ),
249+ $ this ->equalTo ([
250+ 'timeout ' => 10 ,
251+ 'headers ' => [
252+ 'Accept-Encoding ' => 'gzip ' ,
253+ ]
254+ ])
255+ )
248256 ->willReturn ($ response );
249257 $ response
250258 ->expects ($ this ->once ())
@@ -332,7 +340,15 @@ public function testGetWithAlreadyExistingFileAndNoVersion() {
332340 $ client
333341 ->expects ($ this ->once ())
334342 ->method ('get ' )
335- ->with ($ this ->endpoint )
343+ ->with (
344+ $ this ->equalTo ($ this ->endpoint ),
345+ $ this ->equalTo ([
346+ 'timeout ' => 10 ,
347+ 'headers ' => [
348+ 'Accept-Encoding ' => 'gzip ' ,
349+ ]
350+ ])
351+ )
336352 ->willReturn ($ response );
337353 $ response
338354 ->expects ($ this ->once ())
@@ -415,7 +431,15 @@ public function testGetWithAlreadyExistingFileAndOutdatedVersion() {
415431 $ client
416432 ->expects ($ this ->once ())
417433 ->method ('get ' )
418- ->with ($ this ->endpoint )
434+ ->with (
435+ $ this ->equalTo ($ this ->endpoint ),
436+ $ this ->equalTo ([
437+ 'timeout ' => 10 ,
438+ 'headers ' => [
439+ 'Accept-Encoding ' => 'gzip ' ,
440+ ]
441+ ])
442+ )
419443 ->willReturn ($ response );
420444 $ response
421445 ->expects ($ this ->once ())
@@ -480,7 +504,15 @@ public function testGetWithExceptionInClient() {
480504 $ client
481505 ->expects ($ this ->once ())
482506 ->method ('get ' )
483- ->with ($ this ->endpoint )
507+ ->with (
508+ $ this ->equalTo ($ this ->endpoint ),
509+ $ this ->equalTo ([
510+ 'timeout ' => 10 ,
511+ 'headers ' => [
512+ 'Accept-Encoding ' => 'gzip ' ,
513+ ]
514+ ])
515+ )
484516 ->willThrowException (new \Exception ());
485517
486518 $ this ->assertSame ([], $ this ->fetcher ->get ());
@@ -518,11 +550,11 @@ public function testGetMatchingETag() {
518550 $ this ->timeFactory
519551 ->expects ($ this ->at (0 ))
520552 ->method ('getTime ' )
521- ->willReturn (1501 );
553+ ->willReturn (4801 );
522554 $ this ->timeFactory
523555 ->expects ($ this ->at (1 ))
524556 ->method ('getTime ' )
525- ->willReturn (1502 );
557+ ->willReturn (4802 );
526558 $ client = $ this ->createMock (IClient::class);
527559 $ this ->clientService
528560 ->expects ($ this ->once ())
@@ -537,14 +569,15 @@ public function testGetMatchingETag() {
537569 $ this ->equalTo ([
538570 'timeout ' => 10 ,
539571 'headers ' => [
540- 'If-None-Match ' => '"myETag" '
572+ 'Accept-Encoding ' => 'gzip ' ,
573+ 'If-None-Match ' => '"myETag" ' ,
541574 ]
542575 ])
543576 )->willReturn ($ response );
544577 $ response ->method ('getStatusCode ' )
545578 ->willReturn (304 );
546579
547- $ newData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502 ,"ncversion":"11.0.0.2","ETag":"\"myETag\""} ' ;
580+ $ newData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":4802 ,"ncversion":"11.0.0.2","ETag":"\"myETag\""} ' ;
548581 $ file
549582 ->expects ($ this ->at (1 ))
550583 ->method ('putContent ' )
@@ -609,6 +642,7 @@ public function testGetNoMatchingETag() {
609642 $ this ->equalTo ([
610643 'timeout ' => 10 ,
611644 'headers ' => [
645+ 'Accept-Encoding ' => 'gzip ' ,
612646 'If-None-Match ' => '"myETag" ' ,
613647 ]
614648 ])
@@ -623,7 +657,7 @@ public function testGetNoMatchingETag() {
623657 $ response ->method ('getHeader ' )
624658 ->with ($ this ->equalTo ('ETag ' ))
625659 ->willReturn ('"newETag" ' );
626- $ fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502 ,"ncversion":"11.0.0.2","ETag":"\"newETag\""} ' ;
660+ $ fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":4802 ,"ncversion":"11.0.0.2","ETag":"\"newETag\""} ' ;
627661 $ file
628662 ->expects ($ this ->at (1 ))
629663 ->method ('putContent ' )
@@ -635,11 +669,11 @@ public function testGetNoMatchingETag() {
635669 $ this ->timeFactory
636670 ->expects ($ this ->at (0 ))
637671 ->method ('getTime ' )
638- ->willReturn (1501 );
672+ ->willReturn (4801 );
639673 $ this ->timeFactory
640674 ->expects ($ this ->at (1 ))
641675 ->method ('getTime ' )
642- ->willReturn (1502 );
676+ ->willReturn (4802 );
643677
644678 $ expected = [
645679 [
@@ -695,6 +729,9 @@ public function testFetchAfterUpgradeNoETag() {
695729 $ this ->equalTo ($ this ->endpoint ),
696730 $ this ->equalTo ([
697731 'timeout ' => 10 ,
732+ 'headers ' => [
733+ 'Accept-Encoding ' => 'gzip ' ,
734+ ],
698735 ])
699736 )
700737 ->willReturn ($ response );
0 commit comments