Skip to content

Commit 5cef1de

Browse files
committed
Updated and improved TwilioProviderTest
1 parent b74ac9c commit 5cef1de

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/TwilioProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public function register(): void
6767
public function provides(): array
6868
{
6969
return [
70+
TwilioChannel::class,
7071
TwilioConfig::class,
7172
TwilioService::class,
72-
TwilioChannel::class,
7373
];
7474
}
7575
}

tests/Integration/TwilioProviderTest.php

+19-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@
77
use NotificationChannels\Twilio\Exceptions\InvalidConfigException;
88
use NotificationChannels\Twilio\Tests\IntegrationTestCase;
99
use NotificationChannels\Twilio\TwilioChannel;
10+
use NotificationChannels\Twilio\TwilioConfig;
11+
use NotificationChannels\Twilio\TwilioProvider;
12+
use Twilio\Rest\Client;
1013

1114
class TwilioProviderTest extends IntegrationTestCase
1215
{
13-
public function testThatApplicationCannotCreateChannelWithoutConfig()
16+
/** @test */
17+
public function it_cannot_create_the_application_without_config()
1418
{
1519
$this->expectException(InvalidConfigException::class);
1620

1721
$this->app->get(TwilioChannel::class);
1822
}
1923

20-
public function testThatApplicationCannotCreateChannelWithoutSid()
24+
/** @test */
25+
public function it_cannot_create_the_application_without_sid()
2126
{
2227
$this->app['config']->set('twilio-notification-channel.username', 'test');
2328
$this->app['config']->set('twilio-notification-channel.username', 'password');
@@ -26,12 +31,23 @@ public function testThatApplicationCannotCreateChannelWithoutSid()
2631
$this->app->get(TwilioChannel::class);
2732
}
2833

29-
public function testThatApplicationCreatesChannelWithConfig()
34+
/** @test */
35+
public function it_can_create_the_application_with_sid()
3036
{
3137
$this->app['config']->set('twilio-notification-channel.username', 'test');
3238
$this->app['config']->set('twilio-notification-channel.password', 'password');
3339
$this->app['config']->set('twilio-notification-channel.account_sid', '1234');
3440

3541
$this->assertInstanceOf(TwilioChannel::class, $this->app->get(TwilioChannel::class));
3642
}
43+
44+
/** @test */
45+
public function it_provides_three_classes()
46+
{
47+
$provides = (new TwilioProvider($this->app))->provides();
48+
49+
$this->assertTrue(in_array(TwilioChannel::class, $provides));
50+
$this->assertTrue(in_array(TwilioConfig::class, $provides));
51+
$this->assertTrue(in_array(Client::class, $provides));
52+
}
3753
}

0 commit comments

Comments
 (0)