Skip to content

Commit

Permalink
add webhooks find all test
Browse files Browse the repository at this point in the history
  • Loading branch information
7ail committed Feb 9, 2022
1 parent bc0cf48 commit 83a1672
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/Zendesk/API/UnitTests/Core/WebhooksTest.php
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]
);
}
}

0 comments on commit 83a1672

Please sign in to comment.