You are here

public function MessageSubscribeEmailSubscribersTest::setUp in Message Subscribe 8

Overrides MessageSubscribeEmailTestBase::setUp

File

message_subscribe_email/tests/src/Kernel/MessageSubscribeEmailSubscribersTest.php, line 21

Class

MessageSubscribeEmailSubscribersTest
Test getting email subscribes from context.

Namespace

Drupal\Tests\message_subscribe_email\Kernel

Code

public function setUp() {
  parent::setUp();

  // Opt out of default email notifications and subscribe to node 1.
  $flag = $this->flagService
    ->getFlagById('subscribe_node');
  foreach (range(1, 2) as $i) {
    $this->users[$i]->message_subscribe_email = 0;
    $this->users[$i]
      ->save();
    $this->flagService
      ->flag($flag, $this->nodes[1], $this->users[$i]);
  }

  // Flag user 1 for email notifications.
  $flag = $this->flagService
    ->getFlagById('email_node');
  $this->flagService
    ->flag($flag, $this->nodes[1], $this->users[1]);
}