Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v4-api-oauth' into v4-api-accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
n7studios committed Mar 21, 2024
2 parents 7611da7 + 96016ef commit 8c9ded9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ConvertKit_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ private function strip_html_head_body_tags(string $markup)
* @return array<string, string|integer>
*/
private function build_pagination_params(
array $params,
array $params = [],
string $after_cursor = '',
string $before_cursor = '',
int $per_page = 100
Expand Down
34 changes: 34 additions & 0 deletions tests/ConvertKitAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2911,4 +2911,38 @@ private function mockResponse(ConvertKit_API $api, $responseBody = null, int $ht
// Return API object.
return $api;
}

/**
* Helper method to assert the given key exists as an array
* in the API response.
*
* @since 2.0.0
*
* @param array $result API Result.
*/
private function assertDataExists($result, $key)
{
$result = get_object_vars($result);
$this->assertArrayHasKey($key, $result);
$this->assertIsArray($result[$key]);
}

/**
* Helper method to assert pagination object exists in response.
*
* @since 2.0.0
*
* @param array $result API Result.
*/
private function assertPaginationExists($result)
{
$result = get_object_vars($result);
$this->assertArrayHasKey('pagination', $result);
$pagination = get_object_vars($result['pagination']);
$this->assertArrayHasKey('has_previous_page', $pagination);
$this->assertArrayHasKey('has_next_page', $pagination);
$this->assertArrayHasKey('start_cursor', $pagination);
$this->assertArrayHasKey('end_cursor', $pagination);
$this->assertArrayHasKey('per_page', $pagination);
}
}

0 comments on commit 8c9ded9

Please sign in to comment.