$this->
drupalLogin($this->webUser
);
// Submit contact form with correct values and check flood interval.
for ($i = 0;
$i <
$flood_limit;
$i++
) { $this->
submitPersonalContact($this->contactUser
);
$this->
assertSession()->
pageTextContains('Your message has been sent.'
);
} // Submit contact form one over limit.
$this->
submitPersonalContact($this->contactUser
);
// Normal user should be denied access to flooded contact form.
$interval = \Drupal::
service('date.formatter'
)->
formatInterval($this->
config('contact.settings'
)->
get('flood.interval'
));
$this->
assertSession()->
pageTextContains("You cannot send more than 3 messages in {
$interval}. Try again later."
);
// Test that the admin user can still access the contact form even though
// the flood limit was reached.
$this->
drupalLogin($this->adminUser
);
$this->
assertSession()->
pageTextNotContains('Try again later.'
);
} /**
* Tests the personal contact form based access when an admin adds users.
*/