You are here

public function MessageTest::testGetOwner in Message 8

Tests getting the user.

File

tests/src/Kernel/MessageTest.php, line 68

Class

MessageTest
Kernel tests for the Message entity.

Namespace

Drupal\Tests\message\Kernel

Code

public function testGetOwner() {
  $message = Message::create([
    'template' => $this->messageTemplate
      ->id(),
  ]);
  $account = $this
    ->createUser();
  $message
    ->setOwner($account);
  $this
    ->assertEquals($account
    ->id(), $message
    ->getOwnerId());
  $owner = $message
    ->getOwner();
  $this
    ->assertEquals($account
    ->id(), $owner
    ->id());
}