public function LoginSecurityUserBlockingTest::testLoginMessage in Login Security 7
Same name and namespace in other branches
- 6 login_security.test \LoginSecurityUserBlockingTest::testLoginMessage()
Test login message.
File
- ./
login_security.test, line 169 - Test the basic functions of the Login Security module.
Class
- LoginSecurityUserBlockingTest
- Test login_security user blocking.
Code
public function testLoginMessage() {
$normal_user = $this
->drupalCreateUser(array(
'access content',
));
variable_set('login_security_last_login_timestamp', 1);
variable_set('login_security_last_access_timestamp', 1);
$this
->drupalLogin($normal_user);
// This is the very first login ever, so there should be no previous login
// to show.
$this
->assertNoText(t('Your last login was'), t('Last login message not found.'));
variable_set('login_security_last_login_timestamp', 0);
variable_set('login_security_last_access_timestamp', 0);
$this
->drupalLogin($normal_user);
$this
->assertNoText(t('Your last login was'), t('Last login message not found.'));
$this
->assertNoText(t('Your last page access (site activity) was '), t('Last page access message not found.'));
variable_set('login_security_last_login_timestamp', 1);
$this
->drupalLogin($normal_user);
$this
->assertText(t('Your last login was'), t('Last login message found.'));
$this
->assertNoText(t('Your last page access (site activity) was '), t('Last page access message not found.'));
variable_set('login_security_last_login_timestamp', 0);
variable_set('login_security_last_access_timestamp', 1);
$this
->drupalLogin($normal_user);
$this
->assertNoText(t('Your last login was'), t('Last login message not found.'));
$this
->assertText(t('Your last page access (site activity) was '), t('Last page access message found.'));
variable_set('login_security_last_login_timestamp', 1);
$this
->drupalLogin($normal_user);
$this
->assertText(t('Your last login was'), t('Last login message found.'));
$this
->assertText(t('Your last page access (site activity) was '), t('Last page access message found.'));
$this
->clickLink(t('My account'));
}