TC-PROD-04
Functional
Stopping pagination at an existing ID
Verify that pagination can be stopped when an already-saved ID is encountered
Specification · xlsx
Steps
- Retrieve page=0
- Stop further pagination when a known ID appears
Expected result
The integration stops calling further pages
Endpoints
GET /product/api/v1/merchant-integration/products Run
- API_URL
https://api.qa2.ananastest.com- TARGET_ID
2555660
A dry run builds every request without sending it; responses come from a local stub.
Test code
mirrors tests/ProductsTest.php::tc_prod_04()
44// Verify that pagination can be stopped when an already-saved ID is encountered
45public function tc_prod_04(): void
46{
47 $targetId = (int) $_ENV['TARGET_ID'];
48
49 for ($page = 0; $page < 100; $page++) {
50 $response = $this->ananas->getProducts($page, 200);
51
52 foreach ($response['response'] as $item) {
53 if ((int) $item['id'] === $targetId) {
54 break 2;
55 }
56 }
57 }
58
59 $this->assertEquals(0, $page);
60}
web/app/Scenarios/ProductsScenarios.php · line numbers refer to this file
Not run yet. Run it against the API, or do a dry run to see the requests it would send.