You are here

public function ContentHubClientMock::addWebhook in Acquia Content Hub 8.2

File

tests/modules/acquia_contenthub_server_test/src/Client/ContentHubClientMock.php, line 87

Class

ContentHubClientMock
Mocks server responses.

Namespace

Drupal\acquia_contenthub_server_test\Client

Code

public function addWebhook($webhook_url) {
  $this->testWebhook['url'] = $webhook_url;
  if (strpos($webhook_url, MockDataProvider::VALID_WEBHOOK_URL) === FALSE) {
    return [
      'success' => FALSE,
      'error' => [
        'code' => 4005,
        'message' => 'The provided URL did not respond with a valid authorization.',
      ],
      'request_id' => MockDataProvider::randomUuid(),
    ];
  }
  return [
    'client_name' => $this->options['name'],
    'client_uuid' => $this->options['uuid'],
    'disable_retries' => TRUE,
    'url' => $webhook_url,
    'uuid' => $this->testWebhook['uuid'],
  ];
}