Project

General

Profile

Revision 4019484b

Added by Assos Assos over 4 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/honeypot/honeypot.test
192 192
    $this->assertNoRaw('There was a problem with your form submission. Please wait 6 seconds and try again.');
193 193
    $this->assertFalse($form_errors, 'The were no validation errors when submitting the form.');
194 194
  }
195

  
196
  /**
197
   * Test that any (not-strict-empty) value triggers protection.
198
   */
199
  public function testStrictEmptinessOnHoneypotField() {
200
    // Initialise the form values.
201
    $edit['name'] = $this->randomName();
202
    $edit['mail'] = $edit['name'] . '@example.com';
203

  
204
    // Any value that is not strictly empty should trigger Honeypot.
205
    foreach (['0', ' '] as $value) {
206
      $edit['url'] = $value;
207
      $this->drupalPost('user/register', $edit, t('Create new account'));
208
      $this->assertText(t('There was a problem with your form submission. Please refresh the page and try again.'), "Honeypot protection is triggered when the honeypot field contains '{$value}'.");
209
    }
210
  }
195 211
}
196 212

  
197 213
/**

Also available in: Unified diff