mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Implement force sender for SMS
This commit is contained in:
parent
2aa4f061c5
commit
39757ea3db
2 changed files with 37 additions and 0 deletions
|
|
@ -475,6 +475,11 @@ class SMS
|
|||
return false;
|
||||
}
|
||||
|
||||
if (config('sms.default_force') && config('sms.default_from'))
|
||||
{
|
||||
$this->setFrom(config('sms.default_from'));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ($this->driver)
|
||||
|
|
|
|||
|
|
@ -149,8 +149,39 @@ class SMSTest extends \Codeception\TestCase\Test
|
|||
$this->assertFalse($sms->isSplitLMSAllowed());
|
||||
}
|
||||
|
||||
public function testForceSender()
|
||||
{
|
||||
config('sms.default_from', '010-9999-8888');
|
||||
config('sms.default_force', true);
|
||||
$driver = Rhymix\Framework\Drivers\SMS\Dummy::getInstance(array());
|
||||
Rhymix\Framework\SMS::setDefaultDriver($driver);
|
||||
|
||||
$driver->resetSentMessages();
|
||||
$sms = new Rhymix\Framework\SMS;
|
||||
$sms->setFrom('010-7777-6666');
|
||||
$sms->addTo('010-5555-4444');
|
||||
$sms->setContent('Hello World');
|
||||
$sms->send();
|
||||
|
||||
$messages = $driver->getSentMessages();
|
||||
$this->assertEquals('01099998888', $messages[0]->from);
|
||||
|
||||
config('sms.default_force', false);
|
||||
|
||||
$driver->resetSentMessages();
|
||||
$sms = new Rhymix\Framework\SMS;
|
||||
$sms->setFrom('010-7777-6666');
|
||||
$sms->addTo('010-5555-4444');
|
||||
$sms->setContent('Hello World');
|
||||
$sms->send();
|
||||
|
||||
$messages = $driver->getSentMessages();
|
||||
$this->assertEquals('01077776666', $messages[0]->from);
|
||||
}
|
||||
|
||||
public function testSMSSendSMSAndLMS()
|
||||
{
|
||||
config('sms.default_force', false);
|
||||
config('sms.allow_split.sms', true);
|
||||
config('sms.allow_split.lms', true);
|
||||
|
||||
|
|
@ -238,6 +269,7 @@ class SMSTest extends \Codeception\TestCase\Test
|
|||
|
||||
public function testSMSSendMMS()
|
||||
{
|
||||
config('sms.default_force', false);
|
||||
config('sms.allow_split.sms', true);
|
||||
config('sms.allow_split.lms', true);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue