You are here

public function SmsFrameworkMessageResultTestTrait::testErrorMessage in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/SmsFrameworkMessageResultTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkMessageResultTestTrait::testErrorMessage()
  2. 2.1.x tests/src/Functional/SmsFrameworkMessageResultTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkMessageResultTestTrait::testErrorMessage()

Tests error message.

@covers ::getErrorMessage @covers ::setErrorMessage

File

tests/src/Functional/SmsFrameworkMessageResultTestTrait.php, line 38

Class

SmsFrameworkMessageResultTestTrait
Provides common tests for SmsMessageResult object and entity classes.

Namespace

Drupal\Tests\sms\Functional

Code

public function testErrorMessage() {
  $result = $this
    ->createMessageResult();
  $this
    ->assertEquals('', $result
    ->getErrorMessage(), 'Default value is empty string');
  $error_message = $this
    ->getRandomGenerator()
    ->string();
  $return = $result
    ->setErrorMessage($error_message);
  $this
    ->assertTrue($return instanceof SmsMessageResultInterface);
  $this
    ->assertEquals($error_message, $result
    ->getErrorMessage());
}