You are here

public function HoneypotAdminFormTest::testElementNameUpdateFirstCharacterFail in Honeypot 2.0.x

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

Test an invalid element name (invalid first character).

File

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

Class

HoneypotAdminFormTest
Test Honeypot spam protection admin form functionality.

Namespace

Drupal\Tests\honeypot\Functional

Code

public function testElementNameUpdateFirstCharacterFail() {

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

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

  // Form submission should fail.
  $this
    ->assertSession()
    ->pageTextContains('The element name must start with a letter.');
}