protected function BotchaBaseWebTestCase::assertUserLoginFormSubmission in BOTCHA Spam Prevention 6.2
Same name and namespace in other branches
- 6.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::assertUserLoginFormSubmission()
- 7.2 botcha.test \BotchaBaseWebTestCase::assertUserLoginFormSubmission()
- 7.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::assertUserLoginFormSubmission()
Assert submission of user login form, check whether it works how it should.
Parameters
type $edit:
type $should_pass:
1 call to BotchaBaseWebTestCase::assertUserLoginFormSubmission()
- BotchaBaseWebTestCase::assertFormSubmission in ./
botcha.test - Check whether our suspections are real.
File
- ./
botcha.test, line 664 - Tests for BOTCHA module.
Class
- BotchaBaseWebTestCase
- Base class for BOTCHA tests.
Code
protected function assertUserLoginFormSubmission($edit, $should_pass, $button) {
switch ($should_pass) {
case FALSE:
// Check for error message.
$this
->assertText(BOTCHA_WRONG_RESPONSE_ERROR_MESSAGE, 'BOTCHA should block user login form', 'BOTCHA');
// And make sure that user is not logged in:
// check for name and password fields on ?q=user.
$this
->drupalGet('user');
$this
->assertField('name', t('Username field found.'), 'BOTCHA');
$this
->assertField('pass', t('Password field found.'), 'BOTCHA');
break;
case TRUE:
default:
// If log in was successful, log out to continue testing.
$this
->drupalLogout();
break;
}
}