public function MessageSubscribeEmailTestBase::setUp in Message Subscribe 8
Overrides MessageSubscribeTestBase::setUp
2 calls to MessageSubscribeEmailTestBase::setUp()
- MessageSubscribeEmailNotificationsTest::setUp in message_subscribe_email/
tests/ src/ Kernel/ MessageSubscribeEmailNotificationsTest.php - MessageSubscribeEmailSubscribersTest::setUp in message_subscribe_email/
tests/ src/ Kernel/ MessageSubscribeEmailSubscribersTest.php
2 methods override MessageSubscribeEmailTestBase::setUp()
- MessageSubscribeEmailNotificationsTest::setUp in message_subscribe_email/
tests/ src/ Kernel/ MessageSubscribeEmailNotificationsTest.php - MessageSubscribeEmailSubscribersTest::setUp in message_subscribe_email/
tests/ src/ Kernel/ MessageSubscribeEmailSubscribersTest.php
File
- message_subscribe_email/
tests/ src/ Kernel/ MessageSubscribeEmailTestBase.php, line 49
Class
- MessageSubscribeEmailTestBase
- Test base for message subscribe email tests.
Namespace
Drupal\Tests\message_subscribe_email\KernelCode
public function setUp() {
parent::setUp();
$this
->installConfig([
'message_subscribe_email',
]);
$this->flagService = $this->container
->get('flag');
// Create node-type.
$node_type = $this
->createContentType();
// Enable flags.
$flags = $this->flagService
->getAllFlags();
$flag = $flags['subscribe_node'];
$flag
->set('bundles', [
$node_type
->id(),
]);
$flag
->enable();
$flag
->save();
$flag = $flags['email_node'];
$flag
->set('bundles', [
$node_type
->id(),
]);
$flag
->enable();
$flag
->save();
$permissions = [
'flag subscribe_node',
'unflag subscribe_node',
'flag email_node',
'unflag email_node',
];
$this->users[1] = $this
->createUser($permissions);
$this->users[2] = $this
->createUser($permissions);
$this->users[3] = $this
->createUser($permissions);
// Create nodes.
$settings = [];
$settings['type'] = $node_type
->id();
$settings['uid'] = $this->users[1]
->id();
$this->nodes[1] = $this
->createNode($settings);
$this->nodes[2] = $this
->createNode($settings);
// Create a dummy message-type.
$this->messageTemplate = MessageTemplate::create([
'template' => 'foo',
]);
$this->messageTemplate
->save();
$this
->config('message_subscribe.settings')
->set('default_notifiers', [])
->set('notify_own_actions', TRUE)
->save();
$this->messageSubscribers = $this->container
->get('message_subscribe.subscribers');
}