public function WebhookHashTest::testWebhook in Mailchimp 8
Same name and namespace in other branches
- 2.x tests/src/Functional/WebhookHashTest.php \Drupal\Tests\mailchimp\Functional\WebhookHashTest::testWebhook()
Tests configuring a text editor for an existing text format.
File
- tests/
src/ Functional/ WebhookHashTest.php, line 29
Class
- WebhookHashTest
- Tests Mailchimp webhook protection.
Namespace
Drupal\Tests\mailchimp\FunctionalCode
public function testWebhook() {
// If there are no settings, any request should work.
$this
->drupalGet('mailchimp/webhook/foo');
$this
->assertSession()
->statusCodeEquals(200);
// If a hash is set, an invalid hash should fail.
$this
->config('mailchimp.settings')
->set('webhook_hash', 'bar')
->save();
$this
->drupalGet('mailchimp/webhook/foo');
$this
->assertSession()
->statusCodeEquals(403);
// If a hash is set and it matches, the request should work.
$this
->drupalGet('mailchimp/webhook/bar');
$this
->assertSession()
->statusCodeEquals(200);
}