You are here

public function HoneypotAdminFormTest::testElementNameUpdateSuccess in Honeypot 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/HoneypotAdminFormTest.php \Drupal\Tests\honeypot\Functional\HoneypotAdminFormTest::testElementNameUpdateSuccess()

Test a valid element name.

File

tests/src/Functional/HoneypotAdminFormTest.php, line 55

Class

HoneypotAdminFormTest
Test Honeypot spam protection admin form functionality.

Namespace

Drupal\Tests\honeypot\Functional

Code

public function testElementNameUpdateSuccess() {

  // Log in the admin user.
  $this
    ->drupalLogin($this->adminUser);

  // Set up form and submit it.
  $edit['element_name'] = "test";
  $this
    ->drupalPostForm('admin/config/content/honeypot', $edit, $this
    ->t('Save configuration'));

  // Form should have been submitted successfully.
  $this
    ->assertSession()
    ->pageTextContains('The configuration options have been saved.');

  // Set up form and submit it.
  $edit['element_name'] = "test-1";
  $this
    ->drupalPostForm('admin/config/content/honeypot', $edit, $this
    ->t('Save configuration'));

  // Form should have been submitted successfully.
  $this
    ->assertSession()
    ->pageTextContains('The configuration options have been saved.');
}