Skip to content

Commit b6eb66c

Browse files
fqqdkbencekadaremar
fqqdk
andcommitted
fix contact list fetch endpoint's other default value
- AUT-3246 Co-authored-by: Bence Kadar <bence.kadar@emarsys.com>
1 parent f1b2dd8 commit b6eb66c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Suite/Api/ContactList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function getContactIdsInList(int $customerId, int $contactListId, int $to
129129
}
130130
}
131131

132-
public function getListChunkIterator(int $customerId, int $contactListId, int $chunkSize = 10000) : iterable
132+
public function getListChunkIterator(int $customerId, int $contactListId, int $chunkSize = null) : iterable
133133
{
134134
$next = $this->endPoints->contactIdsInList($customerId, $contactListId, $chunkSize);
135135
try {

test/unit/Suite/Api/ContactListTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,21 @@ public function getContactListChunkIterator_ListFitsInSingleChunk_ContactIdsRetu
341341
$this->assertEquals([[1, 2, 3]], iterator_to_array($iterator));
342342
}
343343

344+
/**
345+
* @test
346+
*/
347+
public function getContactListChunkIterator_ChunkSizeNotPassed_TopNotSentInRequest(): void
348+
{
349+
$chunkSize = 3;
350+
$this->apiClient->expects($this->once())->method('get')
351+
->with("api_base_url/$this->customerId/contactlist/$this->contactListId/contactIds")
352+
->willReturn(
353+
$this->apiSuccess(['value' => [1, 2, 3], 'next' => null])
354+
);
355+
$iterator = $this->listService->getListChunkIterator($this->customerId, $this->contactListId);
356+
$this->assertEquals([[1, 2, 3]], iterator_to_array($iterator));
357+
}
358+
344359
/**
345360
* @test
346361
*/

0 commit comments

Comments
 (0)