You are here

public function SmsFrameworkMessageEntityTest::testSenderEntity in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/SmsFrameworkMessageEntityTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkMessageEntityTest::testSenderEntity()
  2. 2.1.x tests/src/Kernel/SmsFrameworkMessageEntityTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkMessageEntityTest::testSenderEntity()

Tests sender entity.

@covers ::getSenderEntity @covers ::setSenderEntity

File

tests/src/Kernel/SmsFrameworkMessageEntityTest.php, line 138

Class

SmsFrameworkMessageEntityTest
Tests SMS message entity.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testSenderEntity() {
  $sms_message1 = $this
    ->createSmsMessage();
  $this
    ->assertEquals(NULL, $sms_message1
    ->getSenderEntity());
  $sender = EntityTest::create();
  $sender
    ->save();
  $sms_message2 = $this
    ->createSmsMessage();
  $sms_message2
    ->setSenderEntity($sender);
  $this
    ->assertEquals($sender
    ->id(), $sms_message2
    ->getSenderEntity()
    ->id());
}