You are here

public function SmsFrameworkMessageResultTestTrait::testAddReport in SMS Framework 8

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

Tests adding a report to the list of reports.

@covers ::addReport

File

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

Class

SmsFrameworkMessageResultTestTrait
Provides common tests for SmsMessageResult object and entity classes.

Namespace

Drupal\Tests\sms\Functional

Code

public function testAddReport() {
  $result = $this
    ->createMessageResult();
  $this
    ->assertEquals(0, count($result
    ->getReports()), 'There are zero reports.');
  $report = (new SmsDeliveryReport())
    ->setRecipient('123123123');
  $return = $result
    ->addReport($report);
  $this
    ->assertTrue($return instanceof SmsMessageResultInterface, 'Return type is a result object');
  $this
    ->assertEquals(1, count($result
    ->getReports()), 'There is one report.');
}