Skip to content

Commit 14fc85c

Browse files
committed
Merge remote-tracking branch 'origin/v4-api-oauth' into v4-api-sequences
2 parents dbc8f60 + 96016ef commit 14fc85c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/ConvertKitAPITest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,4 +2737,38 @@ private function mockResponse(ConvertKit_API $api, $responseBody = null, int $ht
27372737
// Return API object.
27382738
return $api;
27392739
}
2740+
2741+
/**
2742+
* Helper method to assert the given key exists as an array
2743+
* in the API response.
2744+
*
2745+
* @since 2.0.0
2746+
*
2747+
* @param array $result API Result.
2748+
*/
2749+
private function assertDataExists($result, $key)
2750+
{
2751+
$result = get_object_vars($result);
2752+
$this->assertArrayHasKey($key, $result);
2753+
$this->assertIsArray($result[$key]);
2754+
}
2755+
2756+
/**
2757+
* Helper method to assert pagination object exists in response.
2758+
*
2759+
* @since 2.0.0
2760+
*
2761+
* @param array $result API Result.
2762+
*/
2763+
private function assertPaginationExists($result)
2764+
{
2765+
$result = get_object_vars($result);
2766+
$this->assertArrayHasKey('pagination', $result);
2767+
$pagination = get_object_vars($result['pagination']);
2768+
$this->assertArrayHasKey('has_previous_page', $pagination);
2769+
$this->assertArrayHasKey('has_next_page', $pagination);
2770+
$this->assertArrayHasKey('start_cursor', $pagination);
2771+
$this->assertArrayHasKey('end_cursor', $pagination);
2772+
$this->assertArrayHasKey('per_page', $pagination);
2773+
}
27402774
}

0 commit comments

Comments
 (0)