getApiInstance('key-3ax6xnjp29jd6fds4gc373sgvjxteol0'); $timestamp = 1403645220; $token = '5egbgr1vjgqxtrnp65xfznchgdccwh5d6i09vijqi3whgowmn6'; $signature = '9cfc5c41582e51246e73c88d34db3af0a3a2692a76fbab81492842f000256d33'; $this->assertTrue($api->verifyWebhookSignature($timestamp, $token, $signature)); } public function testVerifyWebhookBad() { $api = $this->getApiInstance('key-3ax6xnjp29jd6fds4gc373sgvjxteol0'); $timestamp = 1403645220; $token = 'owyldpe6nxhmrn78epljl6bj0orrki1u3d2v5e6cnlmmuox8jr'; $signature = '9cfc5c41582e51246e73c88d34db3af0a3a2692a76fbab81492842f000256d33'; $this->assertFalse($api->verifyWebhookSignature($timestamp, $token, $signature)); } public function testVerifyWebhookEmptyRequest() { $api = $this->getApiInstance('key-3ax6xnjp29jd6fds4gc373sgvjxteol0'); $this->assertFalse($api->verifyWebhookSignature(0, '', '')); } public function testIndex() { $this->setRequestMethod('GET'); $this->setRequestUri('/v3/domains/example.com/webhooks'); $this->setHydrateClass(IndexResponse::class); $api = $this->getApiInstance('key'); $api->index('example.com'); } public function testShow() { $this->setRequestMethod('GET'); $this->setRequestUri('/v3/domains/example.com/webhooks/hook_1'); $this->setHydrateClass(ShowResponse::class); $api = $this->getApiInstance('key'); $api->show('example.com', 'hook_1'); } public function testCreate() { $this->setRequestMethod('POST'); $this->setRequestUri('/v3/domains/example.com/webhooks'); $this->setHydrateClass(CreateResponse::class); $this->setRequestBody([ [ 'name' => 'id', 'content' => 'opened', ], [ 'name' => 'url', 'content' => 'url_1', ], [ 'name' => 'url', 'content' => 'url_2', ], ]); $api = $this->getApiInstance('key'); $api->create('example.com', 'opened', ['url_1', 'url_2']); } public function testUpdate() { $this->setRequestMethod('PUT'); $this->setRequestUri('/v3/domains/example.com/webhooks/4711'); $this->setHydrateClass(UpdateResponse::class); $this->setRequestBody([ [ 'name' => 'url', 'content' => 'url_1', ], [ 'name' => 'url', 'content' => 'url_2', ], ]); $api = $this->getApiInstance('key'); $api->update('example.com', '4711', ['url_1', 'url_2']); } public function testDelete() { $this->setRequestMethod('DELETE'); $this->setRequestUri('/v3/domains/example.com/webhooks/4711'); $this->setHydrateClass(DeleteResponse::class); $api = $this->getApiInstance('key'); $api->delete('example.com', '4711'); } }