You are here

public function SmsFrameworkMessageResultTestTrait::testError in SMS Framework 8

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

Tests error.

@covers ::getError @covers ::setError

File

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

Class

SmsFrameworkMessageResultTestTrait
Provides common tests for SmsMessageResult object and entity classes.

Namespace

Drupal\Tests\sms\Functional

Code

public function testError() {
  $result = $this
    ->createMessageResult();
  $this
    ->assertNull($result
    ->getError(), 'Default value is NULL');
  $error = $this
    ->getRandomGenerator()
    ->string();
  $return = $result
    ->setError($error);
  $this
    ->assertTrue($return instanceof SmsMessageResultInterface);
  $this
    ->assertEquals($error, $result
    ->getError());
}