-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace ZEndesk\Api\UnitTests\Core; | ||
|
||
use Zendesk\Api\UnitTests\BasicTest; | ||
|
||
/** | ||
* Webhooks test class | ||
*/ | ||
class WebhooksTest extends BasicTest | ||
{ | ||
/** | ||
* Test find all method | ||
*/ | ||
|
||
public function testFindAll() | ||
{ | ||
$queryParams = [ | ||
'filter[name_contains]' => 'somerule', | ||
]; | ||
|
||
// We expect invalid parameters are removed. | ||
// We also expect url encoded keys and values | ||
$expectedQueryParams = []; | ||
foreach ($queryParams as $key => $value) { | ||
$expectedQueryParams = array_merge($expectedQueryParams, [urlencode($key) => $value]); | ||
} | ||
|
||
$this->assertEndpointCalled( | ||
function () use ($queryParams) { | ||
$this->client->webhooks()->findAll($queryParams); | ||
}, | ||
'webhooks', | ||
'GET', | ||
['queryParams' => $expectedQueryParams] | ||
); | ||
} | ||
} |