function UserMailNotifyTest::testUserMailsNotSent

Same name and namespace in other branches
  1. 11.x core/modules/user/tests/src/Kernel/UserMailNotifyTest.php \Drupal\Tests\user\Kernel\UserMailNotifyTest::testUserMailsNotSent()
  2. 10 core/modules/user/tests/src/Kernel/UserMailNotifyTest.php \Drupal\Tests\user\Kernel\UserMailNotifyTest::testUserMailsNotSent()
  3. 9 core/modules/user/tests/src/Kernel/UserMailNotifyTest.php \Drupal\Tests\user\Kernel\UserMailNotifyTest::testUserMailsNotSent()
  4. 8.9.x core/modules/user/tests/src/Kernel/UserMailNotifyTest.php \Drupal\Tests\user\Kernel\UserMailNotifyTest::testUserMailsNotSent()

Tests mails are not sent when notify.$op is FALSE.

Attributes

#[DataProvider('userMailsProvider')]

Parameters

string $op: The operation being performed on the account.

array $mail_keys: The mail keys to test for.

File

core/modules/user/tests/src/Kernel/UserMailNotifyTest.php, line 108

Class

UserMailNotifyTest
Tests _user_mail_notify() use of user.settings.notify.*.

Namespace

Drupal\Tests\user\Kernel

Code

public function testUserMailsNotSent(string $op, array $mail_keys) : void {
  $this->installConfig('user');
  $this->config('user.settings')
    ->set('notify.' . $op, FALSE)
    ->save();
  $return = _user_mail_notify($op, $this->createUser());
  $this->assertNull($return);
  $this->assertEmpty($this->getMails());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.