You are here

public function WebhooksTest::testContentTypeJson in Webhooks 8

Test webhook content type JSON.

File

tests/src/Functional/WebhooksTest.php, line 279

Class

WebhooksTest
Test description.

Namespace

Drupal\Tests\webhooks\Functional

Code

public function testContentTypeJson() {
  $webhook_config = WebhookConfig::load(self::WEBHOOK_ID_OUTGOING);
  $webhook = new Webhook($this->payload);
  $webhook
    ->setContentType(WebhookConfig::CONTENT_TYPE_JSON);
  $this->webhookService
    ->send($webhook_config, $webhook);

  /** @var \Drupal\webhooks\Webhook $webhook_received */
  $webhook_received = $this->state
    ->get('onWebhookReceive_webhook');
  $this
    ->assertEqual($webhook_received
    ->getContentType(), WebhookConfig::CONTENT_TYPE_JSON);
}