public function HoneypotAdminFormTestCase::testElementNameUpdateInvalidCharacterFail in Honeypot 7
Test an invalid element name (invalid character in name).
File
- ./
honeypot.test, line 278 - Testing for Honeypot module.
Class
- HoneypotAdminFormTestCase
- Test the functionality of the Honeypot module for an admin user.
Code
public function testElementNameUpdateInvalidCharacterFail() {
// Log in the admin user.
$this
->drupalLogin($this->adminUser);
// Set up form and submit it.
$edit['honeypot_element_name'] = "special-character-&";
$this
->drupalPost('admin/config/content/honeypot', $edit, t('Save configuration'));
// Form submission should fail.
$this
->assertText(t('The element name cannot contain spaces or other special characters.'), 'Honeypot element name assertion works for invalid names with special characters.');
// Set up form and submit it.
$edit['honeypot_element_name'] = "space in name";
$this
->drupalPost('admin/config/content/honeypot', $edit, t('Save configuration'));
// Form submission should fail.
$this
->assertText(t('The element name cannot contain spaces or other special characters.'), 'Honeypot element name assertion works for invalid names with spaces.');
}