-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathAfricasTalkingTest.php
More file actions
34 lines (27 loc) · 947 Bytes
/
AfricasTalkingTest.php
File metadata and controls
34 lines (27 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Tests\E2E;
use Utopia\Messaging\Adapters\SMS\AfricasTalking;
use Utopia\Messaging\Messages\SMS;
class AfricasTalkingTest extends Base
{
/**
* @throws \Exception
*/
public function testSendSMS()
{
// username is sandbox for sandbox env
$username = getenv('AFRICASTALKING_USERNAME');
$apiKey = getenv('AFRICASTALKING_API_KEY');
$sender = new AfricasTalking($username, $apiKey);
$message = new SMS(
to: [getenv('SMS_TO')],
// to must be a comma separated string of recipients' phone numbers.
content: 'Test Content',
// from: getenv('SMS_FROM'), optional - https://developers.africastalking.com/docs/sms/sending/bulk
// defaults to AFRICASTKNG.
);
$response = $sender->send($message);
$result = \json_decode($response, true);
$this->assertNotEmpty($result);
}
}