Skip to content

Commit 0593716

Browse files
committed
Adjust tests based on comment from kbsali#436
see kbsali#436 (comment)
1 parent 6c1f1a1 commit 0593716

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/Unit/Api/AbstractApiTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,23 @@ public static function retrieveDataData(): array
398398
];
399399
}
400400

401+
public function testRetrieveDataWith100ResultsMakes1Request(): void
402+
{
403+
$response1 = $this->createStub(Response::class);
404+
$response1->method('getContentType')->willReturn('application/json');
405+
$response1->method('getContent')->willReturn('{"total_count":100,"offset":0,"limit":100,"data":[]}');
406+
407+
$client = $this->createMock(HttpClient::class);
408+
$client->expects($this->once())->method('request')->willReturn($response1);
409+
410+
$api = new class ($client) extends AbstractApi {};
411+
412+
$method = new ReflectionMethod($api, 'retrieveData');
413+
$method->setAccessible(true);
414+
415+
$method->invoke($api, '/data.json', ['limit' => 101]);
416+
}
417+
401418
public function testRetrieveDataWith250ResultsMakes3Requests(): void
402419
{
403420
$response1 = $this->createStub(Response::class);
@@ -420,7 +437,7 @@ public function testRetrieveDataWith250ResultsMakes3Requests(): void
420437
$method = new ReflectionMethod($api, 'retrieveData');
421438
$method->setAccessible(true);
422439

423-
$method->invoke($api, '/data.json', ['limit' => 300]);
440+
$method->invoke($api, '/data.json', ['limit' => 301]);
424441
}
425442

426443
/**

0 commit comments

Comments
 (0)