Skip to content

Commit

Permalink
Fix sell contacts test by url encoding query params for assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
token-cjg committed Sep 24, 2024
1 parent 1184245 commit 4a2ee60
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/Zendesk/API/UnitTests/Sell/ContactsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,20 @@ public function testUpsert()
]
];

$encodedQueryParams = [];
foreach ($queryParams as $key => $value) {
// Don't encode the email address
if ($key === 'email') {
$encodedQueryParams[$key] = $value;
continue;
}
$encodedQueryParams[$key] = rawurlencode($value);
}

$this->assertEndpointCalled(function () use ($queryParams, $postFields) {
$this->client->sell->contacts()->upsert($queryParams, $postFields);
}, '/contacts/upsert', 'POST', [
'queryParams' => $queryParams,
'queryParams' => $encodedQueryParams,
'postFields' => ['data' => $postFields],
'apiBasePath' => '/v2'
]);
Expand Down

0 comments on commit 4a2ee60

Please sign in to comment.