public function EmailActivationTest::testActivationEmailDisabled in Search API Saved Searches 8
Tests that activation will be skipped if the "Send" option is disabled.
File
- tests/
src/ Kernel/ EmailActivationTest.php, line 327
Class
- EmailActivationTest
- Tests whether activation mails are sent correctly.
Namespace
Drupal\Tests\search_api_saved_searches\KernelCode
public function testActivationEmailDisabled() {
$type = SavedSearchType::load('default');
$type
->getNotificationPlugin('email')
->setConfiguration([
'activate' => [
'send' => FALSE,
'title' => 'Test',
'body' => 'Test',
],
]);
$type
->save();
// Save a new search.
$search = SavedSearch::create([
'type' => 'default',
'label' => 'Test search 1',
'mail' => 'foo@example.net',
]);
$this
->assertEquals(SAVED_NEW, $search
->save());
$this
->sendMails();
// Saved search should be active, no mail should have been sent.
$this
->assertTrue($search
->get('status')->value);
$captured_emails = \Drupal::state()
->get('system.test_mail_collector');
$this
->assertEmpty($captured_emails);
}