From ce34209c328c83e459cad4ece826129e5e1a6e27 Mon Sep 17 00:00:00 2001 From: overtrue Date: Mon, 13 Mar 2017 16:56:13 +0800 Subject: [PATCH] Don't care about signatures. --- README.md | 1 - src/EasySms.php | 6 +----- src/Gateways/YunPianGateway.php | 2 +- tests/Gateways/YunPianGatewayTest.php | 3 +-- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3a1926a..19b2e0c 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,6 @@ use Overtrue\EasySms\EasySms; $config = [ 'default' => 'error-log', - 'signature' => '【xxx公司】', 'gateways' => [ /*...*/ 'error-log' => [ diff --git a/src/EasySms.php b/src/EasySms.php index 7cdf67c..130bba6 100644 --- a/src/EasySms.php +++ b/src/EasySms.php @@ -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)) { diff --git a/src/Gateways/YunPianGateway.php b/src/Gateways/YunPianGateway.php index 9729726..68b95cf 100644 --- a/src/Gateways/YunPianGateway.php +++ b/src/Gateways/YunPianGateway.php @@ -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, ]); } diff --git a/tests/Gateways/YunPianGatewayTest.php b/tests/Gateways/YunPianGatewayTest.php index 58c935d..2938297 100644 --- a/tests/Gateways/YunPianGatewayTest.php +++ b/tests/Gateways/YunPianGatewayTest.php @@ -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', [ @@ -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.')); } }