Skip to content

Commit

Permalink
Marking class Message as deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
zingimmick committed May 1, 2020
1 parent 76cf350 commit 33fcdbd
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
```

Expand Down
6 changes: 3 additions & 3 deletions src/Channels/SmsChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -44,15 +44,15 @@ public function send($notifiable, Notification $notification)
}

if (is_string($message)) {
$message = new Message(
$message = new SmsMessage(
[
'content' => $message,
'template' => $message,
]
);
}

if (! $message instanceof Message) {
if (! $message instanceof SmsMessage) {
return;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/Drivers/MeiLianDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions tests/Drivers/NullDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
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
{
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());
}

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());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Drivers/YunpianDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
[
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
2 changes: 1 addition & 1 deletion tests/SmsManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')],
];
}

Expand Down
4 changes: 2 additions & 2 deletions tests/VerifyCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -17,6 +17,6 @@ public function via()

public function toSms($notifiable)
{
return Message::text('')->onConnection('log');
return SmsMessage::text('')->onConnection('log');
}
}

0 comments on commit 33fcdbd

Please sign in to comment.