LoginSecurityEmailTest.php in Login Security 2.x
File
tests/src/Functional/LoginSecurityEmailTest.php
View source
<?php
namespace Drupal\Tests\login_security\Functional;
use Drupal\Core\Form\FormState;
use Drupal\Core\Test\AssertMailTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
class LoginSecurityEmailTest extends LoginSecurityTestBase {
use AssertMailTrait;
use StringTranslationTrait;
public static $modules = [
'user',
'login_security',
];
protected $account;
public function setUp() {
parent::setUp();
$this
->drupalCreateUser();
$this->account = $this
->drupalCreateUser();
$this
->drupalLoginLite($this->account);
\Drupal::configFactory()
->getEditable('login_security.settings')
->set('user_blocked_notification_emails', 'test@test.com')
->set('login_activity_notification_emails', 'test@test.com')
->save();
}
public function testBlockedEmail() {
$variables = [
'@uid' => $this->account
->id(),
];
$form_state = new FormState();
login_user_block_user_name($variables, $form_state);
$this
->assertMail('to', 'test@test.com', 'Mail sent when a user is blocked.');
}
public function testActivityThresholdEmail() {
}
}