public function UserNotificationEmailTest::testNoEmailToUserWithNoEmailAddress in Private Message 8
Test that no email is attempted if a user has no email address.
File
- tests/
src/ Kernel/ UserNotificationEmailTest.php, line 134
Class
- UserNotificationEmailTest
- Tests notification emails when a new private message is created.
Namespace
Drupal\Tests\private_message\KernelCode
public function testNoEmailToUserWithNoEmailAddress() {
$owner = $this
->createUser();
$member = $this
->createUser([
'mail' => NULL,
]);
\Drupal::currentUser()
->setAccount($owner);
$message = $this
->createMessage([
'owner' => $owner,
]);
$this->threadManager
->saveThread($message, [
$owner,
$member,
]);
$this
->assertEmpty($this
->getMails(), 'Attempted to send email to a NULL address.');
}