From 33fcdbd4ff5c100ca46e6b793f62f1627e3614ac Mon Sep 17 00:00:00 2001 From: zingimmick Date: Sat, 2 May 2020 04:08:36 +0800 Subject: [PATCH] Marking class Message as deprecated. --- README.md | 4 ++-- src/Channels/SmsChannel.php | 6 +++--- tests/Drivers/MeiLianDriverTest.php | 8 ++++---- tests/Drivers/NullDriverTest.php | 6 +++--- tests/Drivers/YunpianDriverTest.php | 6 +++--- tests/MessageTest.php | 8 ++++---- tests/SmsManagerTest.php | 2 +- tests/VerifyCode.php | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index eb5c092..21efee8 100644 --- a/README.md +++ b/README.md @@ -135,11 +135,11 @@ Sms::connection('null')->send(18188888888, 'test message.'); **NOTE:** Only support for `Zing\LaravelSms\Message` ```php - use Zing\LaravelSms\Message; + use Zing\LaravelSms\SmsMessage; public function toSms($notifiable) { - return (new Message())->onConnection('log'); + return (new SmsMessage())->onConnection('log'); } ``` diff --git a/src/Channels/SmsChannel.php b/src/Channels/SmsChannel.php index c883119..4de10db 100644 --- a/src/Channels/SmsChannel.php +++ b/src/Channels/SmsChannel.php @@ -7,8 +7,8 @@ use Illuminate\Notifications\AnonymousNotifiable; use Illuminate\Notifications\Notification; use RuntimeException; -use Zing\LaravelSms\Message; use Zing\LaravelSms\SmsManager; +use Zing\LaravelSms\SmsMessage; /** * Class SmsChannel. @@ -44,7 +44,7 @@ public function send($notifiable, Notification $notification) } if (is_string($message)) { - $message = new Message( + $message = new SmsMessage( [ 'content' => $message, 'template' => $message, @@ -52,7 +52,7 @@ public function send($notifiable, Notification $notification) ); } - if (! $message instanceof Message) { + if (! $message instanceof SmsMessage) { return; } diff --git a/tests/Drivers/MeiLianDriverTest.php b/tests/Drivers/MeiLianDriverTest.php index fb1461e..9ebc376 100644 --- a/tests/Drivers/MeiLianDriverTest.php +++ b/tests/Drivers/MeiLianDriverTest.php @@ -9,7 +9,7 @@ use Overtrue\EasySms\Support\Config; use Zing\LaravelSms\Exceptions\CouldNotSendNotification; use Zing\LaravelSms\Gateways\MeilianGateway; -use Zing\LaravelSms\Message; +use Zing\LaravelSms\SmsMessage; use Zing\LaravelSms\Tests\TestCase; class MeiLianDriverTest extends TestCase @@ -41,7 +41,7 @@ public function testSend(): void ->andReturn('success:Missing recipient', 'error:Missing recipient') ->times(2); - $message = Message::text('【test】This is a test message.'); + $message = SmsMessage::text('【test】This is a test message.'); $config = new Config($config); $this->assertSame('success:Missing recipient', $driver->send(new PhoneNumber(18188888888), $message, $config)); @@ -79,7 +79,7 @@ public function testSend2(): void ->andReturn(['test']) ->times(1); - $message = Message::text('【test】This is a test message.'); + $message = SmsMessage::text('【test】This is a test message.'); $config = new Config($config); $this->expectException(CouldNotSendNotification::class); @@ -122,7 +122,7 @@ public function testDefaultSignature($number, $message, $expected): void ] )->andReturn($response); - $this->assertSame($response, $driver->send(new PhoneNumber($number), Message::text($message), $config)); + $this->assertSame($response, $driver->send(new PhoneNumber($number), SmsMessage::text($message), $config)); } public function provideNumberAndMessage() diff --git a/tests/Drivers/NullDriverTest.php b/tests/Drivers/NullDriverTest.php index 485b4d9..183735e 100644 --- a/tests/Drivers/NullDriverTest.php +++ b/tests/Drivers/NullDriverTest.php @@ -8,7 +8,7 @@ use Overtrue\EasySms\PhoneNumber; use Overtrue\EasySms\Support\Config; use Zing\LaravelSms\Facades\Sms; -use Zing\LaravelSms\Message; +use Zing\LaravelSms\SmsMessage; use Zing\LaravelSms\Tests\TestCase; class NullDriverTest extends TestCase @@ -16,7 +16,7 @@ class NullDriverTest extends TestCase public function testSend(): void { $number = new PhoneNumber(18188888888); - $message = Message::text('【test】This is a test message.'); + $message = SmsMessage::text('【test】This is a test message.'); Log::shouldReceive('debug')->withAnyArgs()->twice(); Sms::connection('null')->send($number, $message, new Config()); } @@ -24,7 +24,7 @@ public function testSend(): void public function testSend1(): void { $number = new PhoneNumber(18188888888); - $message = Message::text('【test】This is a test message.'); + $message = SmsMessage::text('【test】This is a test message.'); Log::shouldReceive('debug')->withAnyArgs()->twice(); \Sms::connection('null')->send($number, $message, new Config()); } diff --git a/tests/Drivers/YunpianDriverTest.php b/tests/Drivers/YunpianDriverTest.php index 3757f12..f922719 100644 --- a/tests/Drivers/YunpianDriverTest.php +++ b/tests/Drivers/YunpianDriverTest.php @@ -10,7 +10,7 @@ use Overtrue\EasySms\Support\Config; use Zing\LaravelSms\Exceptions\CouldNotSendNotification; use Zing\LaravelSms\Gateways\YunpianGateway; -use Zing\LaravelSms\Message; +use Zing\LaravelSms\SmsMessage; use Zing\LaravelSms\Tests\TestCase; class YunpianDriverTest extends TestCase @@ -55,7 +55,7 @@ public function testSend(): void ] )->times(2); - $message = Message::text('【test】This is a test message.'); + $message = SmsMessage::text('【test】This is a test message.'); $config = new Config($config); $this->assertSame( [ @@ -125,7 +125,7 @@ public function testDefaultSignature($number, $message, $expected): void ] )->andReturn($response); - $this->assertSame($response, $driver->send(new PhoneNumber($number), Message::text($message), $config)); + $this->assertSame($response, $driver->send(new PhoneNumber($number), SmsMessage::text($message), $config)); } public function testGetOptions(): void diff --git a/tests/MessageTest.php b/tests/MessageTest.php index 7fc2015..4302cfa 100644 --- a/tests/MessageTest.php +++ b/tests/MessageTest.php @@ -5,17 +5,17 @@ namespace Zing\LaravelSms\Tests; use Overtrue\EasySms\Contracts\MessageInterface; -use Zing\LaravelSms\Message; +use Zing\LaravelSms\SmsMessage; class MessageTest extends TestCase { public function testStaticCreate(): void { - $message = Message::text(''); + $message = SmsMessage::text(''); self::assertSame(MessageInterface::TEXT_MESSAGE, $message->getMessageType()); - $message = Message::voice(''); + $message = SmsMessage::voice(''); self::assertSame(MessageInterface::VOICE_MESSAGE, $message->getMessageType()); - $message = Message::fromTemplate('', []); + $message = SmsMessage::fromTemplate('', []); self::assertSame(MessageInterface::TEXT_MESSAGE, $message->getMessageType()); } } diff --git a/tests/SmsManagerTest.php b/tests/SmsManagerTest.php index cd2615f..d46f701 100644 --- a/tests/SmsManagerTest.php +++ b/tests/SmsManagerTest.php @@ -21,7 +21,7 @@ public function provideNumberAndMessage() { return [ ['18888888888', 'test'], - [new PhoneNumber('18888888888', '+86'), \Zing\LaravelSms\Message::text('test')], + [new PhoneNumber('18888888888', '+86'), \Zing\LaravelSms\SmsMessage::text('test')], ]; } diff --git a/tests/VerifyCode.php b/tests/VerifyCode.php index 4345071..d130f9b 100644 --- a/tests/VerifyCode.php +++ b/tests/VerifyCode.php @@ -6,7 +6,7 @@ use Illuminate\Notifications\Notification; use Zing\LaravelSms\Channels\SmsChannel; -use Zing\LaravelSms\Message; +use Zing\LaravelSms\SmsMessage; class VerifyCode extends Notification { @@ -17,6 +17,6 @@ public function via() public function toSms($notifiable) { - return Message::text('')->onConnection('log'); + return SmsMessage::text('')->onConnection('log'); } }