Skip to content

Commit

Permalink
Merge b6e6be8 into 4f8e9ed
Browse files Browse the repository at this point in the history
  • Loading branch information
ftw-soft committed Apr 9, 2020
2 parents 4f8e9ed + b6e6be8 commit 37d539a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -12,7 +12,7 @@
"require": {
"php": ">=7.2",
"guzzlehttp/guzzle": "^6.3",
"intercom/intercom-php": "^3.2",
"intercom/intercom-php": "^3.2 || ^4.0",
"illuminate/notifications": "~5.5 || ~6.0 || ~7.0",
"illuminate/support": "~5.5 || ~6.0 || ~7.0"
},
Expand Down
3 changes: 3 additions & 0 deletions src/IntercomChannel.php
Expand Up @@ -4,6 +4,7 @@

use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\GuzzleException;
use Http\Client\Exception as HttpClientException;
use Illuminate\Notifications\Notification;
use Intercom\IntercomClient;
use NotificationChannels\Intercom\Exceptions\MessageIsNotCompleteException;
Expand Down Expand Up @@ -37,6 +38,7 @@ public function __construct(IntercomClient $client)
*
* @throws MessageIsNotCompleteException When message is not filled correctly
* @throws GuzzleException Other Guzzle uncatched exceptions
* @throws HttpClientException Other HTTP uncatched exceptions
* @throws RequestException When server responses with a bad HTTP code
*
* @see https://developers.intercom.com/intercom-api-reference/reference#admin-initiated-conversation
Expand Down Expand Up @@ -64,6 +66,7 @@ public function getClient(): IntercomClient
*
* @throws MessageIsNotCompleteException
* @throws GuzzleException
* @throws HttpClientException
*/
protected function sendNotification($notifiable, Notification $notification): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/IntercomServiceProvider.php
Expand Up @@ -20,7 +20,7 @@ public function boot(): void
->give(static function () {
/* @var Config $config */
return new IntercomClient(
Config::get('services.intercom.token'),
Config::get('services.intercom.token', ''),
null
);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/IntercomChannelTest.php
Expand Up @@ -37,7 +37,7 @@ protected function setUp(): void
{
parent::setUp();

$this->intercom = new IntercomClient(null, null);
$this->intercom = new IntercomClient('', null);
$this->intercomMessages = Mockery::mock(IntercomMessages::class, $this->intercom);
$this->intercom->messages = $this->intercomMessages;
$this->channel = new IntercomChannel($this->intercom);
Expand Down
9 changes: 0 additions & 9 deletions tests/IntercomServiceProviderTest.php
Expand Up @@ -41,15 +41,6 @@ protected function setUp(): void
$this->serviceProvider->boot();
}

public function testItBootsAndProvidesDIForIntercomClientFromConfig(): void
{
Config::set('services.intercom.token', 'SOME_TOKEN');
/** @var IntercomChannel $client */
$client = $this->app->make(IntercomChannel::class);

self::assertEquals('SOME_TOKEN', $client->getClient()->getAuth()[0]);
}

public function testItRegistersNewIntercomNotificationDriverAlias(): void
{
$this->serviceProvider->register();
Expand Down

0 comments on commit 37d539a

Please sign in to comment.