You are here

public function SmsFrameworkMessageEntityTest::testGateway in SMS Framework 8

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

Tests gateway plugin of SMS messages.

@covers ::getGateway @covers ::setGateway

File

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

Class

SmsFrameworkMessageEntityTest
Tests SMS message entity.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testGateway() {

  // Check for validation violation for missing gateway.
  $sms_message1 = $this
    ->createSmsMessage();
  $this
    ->assertTrue(in_array('gateway', $sms_message1
    ->validate()
    ->getFieldNames()));
  $gateway = $this
    ->createMemoryGateway();
  $sms_message2 = $this
    ->createSmsMessage();
  $sms_message2
    ->setGateway($gateway);
  $this
    ->assertEquals($gateway, $sms_message2
    ->getGateway());
}