You are here

public function HoneypotAdminFormTestCase::testElementNameUpdateSuccess in Honeypot 7

Test a valid element name.

File

./honeypot.test, line 241
Testing for Honeypot module.

Class

HoneypotAdminFormTestCase
Test the functionality of the Honeypot module for an admin user.

Code

public function testElementNameUpdateSuccess() {

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

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

  // Form should have been submitted successfully.
  $this
    ->assertText(t('The configuration options have been saved.'), 'Honeypot element name assertion works for valid names.');

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

  // Form should have been submitted successfully.
  $this
    ->assertText(t('The configuration options have been saved.'), 'Honeypot element name assertion works for valid names with dashes and numbers.');
}