public function SmsFrameworkMessageResultTestTrait::testReports in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Functional/SmsFrameworkMessageResultTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkMessageResultTestTrait::testReports()
- 2.1.x tests/src/Functional/SmsFrameworkMessageResultTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkMessageResultTestTrait::testReports()
Tests setting and getting the list of reports.
@covers ::getReports @covers ::setReports
File
- tests/
src/ Functional/ SmsFrameworkMessageResultTestTrait.php, line 72
Class
- SmsFrameworkMessageResultTestTrait
- Provides common tests for SmsMessageResult object and entity classes.
Namespace
Drupal\Tests\sms\FunctionalCode
public function testReports() {
$result = $this
->createMessageResult();
$recipient = '123123123';
$report = (new SmsDeliveryReport())
->setRecipient($recipient);
$return = $result
->setReports([
$report,
]);
$this
->assertTrue($return instanceof SmsMessageResultInterface);
$reports = $result
->getReports();
$this
->assertEquals(1, count($reports));
$this
->assertTrue($reports[0] instanceof SmsDeliveryReportInterface);
// Verify that a second ::setReports() call clears what was there before.
$report2 = (new SmsDeliveryReport())
->setRecipient('2345678901');
$result
->setReports([
$report2,
]);
$reports = $result
->getReports();
$this
->assertEquals(1, count($reports));
}