public function SmsFrameworkProviderTest::testChunking in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/SmsFrameworkProviderTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkProviderTest::testChunking()
- 2.1.x tests/src/Kernel/SmsFrameworkProviderTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkProviderTest::testChunking()
Test message is split into multiple messages if gateway demands it.
File
- tests/
src/ Kernel/ SmsFrameworkProviderTest.php, line 346
Class
- SmsFrameworkProviderTest
- Tests SMS Framework provider service.
Namespace
Drupal\Tests\sms\KernelCode
public function testChunking() {
$gateway_chunked = SmsGateway::create([
'plugin' => 'memory_chunked',
'id' => 'memory_chunked',
'settings' => [
'gateway_id' => 'memory_chunked',
],
]);
$gateway_chunked
->enable()
->save();
$sms_message = $this
->createSmsMessage()
->setGateway($gateway_chunked)
->addRecipients([
'123123123',
'456456456',
'789789789',
]);
$return = $this->smsProvider
->queue($sms_message);
$this
->assertEquals(2, count(SmsMessage::loadMultiple()), 'One SMS message has been split into two.');
$this
->assertEquals(2, count($return), 'Provider queue method returned two messages.');
}