8 class CRM_SMS_PreviewTest
extends CiviUnitTestCase
{
13 public function setUp() {
15 $option = $this->callAPISuccess('option_value', 'create', ['option_group_id' => 'sms_provider_name', 'name' => 'test_provider_name', 'label' => 'Test Provider Label', 'value' => 1]);
16 $this->option_value
= $option['id'];
20 * Clean up after each test.
22 public function tearDown() {
24 $this->callAPISuccess('option_value', 'delete', ['id' => $this->option_value
]);
30 public function testSMSPreview() {
31 $result = $this->callAPISuccess('SmsProvider', 'create', [
32 'title' => 'test SMS provider',
34 'password' => 'password',
35 // 'name' is the option_value 'value' (not id, not name) we created in setUp()
41 $provider_id = $result['id'];
42 $result = $this->callAPISuccess('Mailing', 'create', [
44 'from_name' => "+12223334444",
45 'from_email' => "test@test.com",
46 'replyto_email' => "test@test.com",
47 'body_text' => "Testing body",
48 'sms_provider_id' => $provider_id,
51 'unsubscribe_id' => NULL,
53 $mailing_id = $result['id'];
54 $result = $this->callAPISuccess('Mailing', 'preview', [