function NotificationHandlerTest::testUserMailsNotSent
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Kernel/NotificationHandlerTest.php \Drupal\Tests\user\Kernel\NotificationHandlerTest::testUserMailsNotSent()
Tests that mails are not sent when disabled.
Attributes
#[DataProvider('userMailsProvider')]
Parameters
string $method: The method to call on the mail handler.
string $configKey: The config key to test.
array $emailKeys: The mail keys to test for.
File
-
core/
modules/ user/ tests/ src/ Kernel/ NotificationHandlerTest.php, line 122
Class
- NotificationHandlerTest
- Tests NotificationHandler use of user.settings.notify.*.
Namespace
Drupal\Tests\user\KernelCode
public function testUserMailsNotSent(string $method, string $configKey, array $emailKeys) : void {
$this->installConfig('user');
$this->config('system.site')
->set('mail', 'test@example.com')
->save();
$this->config('user.settings')
->set($configKey, FALSE)
->save();
$notificationHandler = \Drupal::service(NotificationHandler::class);
$return = $notificationHandler->{$method}($this->createUser());
$this->assertFalse($return);
$this->assertEmpty($this->getMails());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.