Skip to content

Commit

Permalink
Don't care about signatures.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Mar 13, 2017
1 parent c0b408f commit ce34209
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use Overtrue\EasySms\EasySms;

$config = [
'default' => 'error-log',
'signature' => '【xxx公司】',
'gateways' => [
/*...*/
'error-log' => [
Expand Down
6 changes: 1 addition & 5 deletions src/EasySms.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,7 @@ protected function createGateway($name)
$gateway = $this->callCustomCreator($name);
} else {
$className = $this->formatGatewayClassName($name);
$config = array_merge(
['signature' => $this->config->get('signature', '')],
$this->config->get("gateways.{$name}", [])
);
$gateway = $this->makeGateway($className, $config);
$gateway = $this->makeGateway($className, $this->config->get("gateways.{$name}", []));
}

if (!($gateway instanceof GatewayInterface)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Gateways/YunPianGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function send($to, $message, array $data = [])
return $this->post($endpoint, [
'apikey' => $this->config->get('api_key'),
'mobile' => $to,
'text' => $this->config->get('signature').$message,
'text' => $message,
]);
}

Expand Down
3 changes: 1 addition & 2 deletions tests/Gateways/YunPianGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public function testSend()
{
$gateway = \Mockery::mock(YunPianGateway::class.'[post]', [[
'api_key' => 'mock-api-key',
'signature' => '【overtrue】',
]])->shouldAllowMockingProtectedMethods();

$gateway->expects()->post('https://sms.yunpian.com/v2/sms/single_send.json', [
Expand All @@ -27,6 +26,6 @@ public function testSend()
'text' => '【overtrue】This is a test message.',
])->andReturn('mock-result')->once();

$this->assertSame('mock-result', $gateway->send(18188888888, 'This is a test message.'));
$this->assertSame('mock-result', $gateway->send(18188888888, '【overtrue】This is a test message.'));
}
}

0 comments on commit ce34209

Please sign in to comment.