You are here

public function AmazonSesSettingsFormTest::testSettingsProtected in Amazon SES 2.0.x

Tests that the settings form is protected.

File

tests/src/Functional/AmazonSesSettingsFormTest.php, line 50

Class

AmazonSesSettingsFormTest
Tests the Amazon SES settings form.

Code

public function testSettingsProtected() {
  $this
    ->drupalGet(Url::fromRoute('amazon_ses.settings_form'));
  $this
    ->assertSession()
    ->statusCodeEquals(Response::HTTP_OK);
  $this
    ->drupalLogout();
  $this
    ->drupalGet(Url::fromRoute('amazon_ses.settings_form'));
  $this
    ->assertSession()
    ->statusCodeEquals(Response::HTTP_FORBIDDEN);
  $basic_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($basic_user);
  $this
    ->drupalGet(Url::fromRoute('amazon_ses.settings_form'));
  $this
    ->assertSession()
    ->statusCodeEquals(Response::HTTP_FORBIDDEN);
}