-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
| | ||
*/ | ||
'secret' => env('CISCO_SPARK_SECRET'), | ||
]; | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,12 @@ | |
|
||
namespace Tests; | ||
|
||
use BotMan\BotMan\Http\Curl; | ||
use BotMan\Drivers\CiscoSpark\CiscoSparkDriver; | ||
use Mockery as m; | ||
use BotMan\BotMan\Http\Curl; | ||
use PHPUnit_Framework_TestCase; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use BotMan\Drivers\CiscoSpark\CiscoSparkDriver; | ||
|
||
class CiscoSparkDriverTest extends PHPUnit_Framework_TestCase | ||
{ | ||
|
@@ -20,8 +20,8 @@ private function getDriver($responseData, $htmlInterface = null) | |
|
||
return new CiscoSparkDriver($request, [ | ||
'cisco-spark' => [ | ||
'token' => 'my-token' | ||
] | ||
'token' => 'my-token', | ||
], | ||
], $htmlInterface); | ||
} | ||
|
||
|
@@ -44,8 +44,8 @@ private function getValidTestData() | |
'roomId' => 'Y2lzY29zcGFyazovL3VzL1JPT00vY2RlMWRkNDAtMmYwZC0xMWU1LWJhOWMtN2I2NTU2ZDIyMDdi', | ||
'personId' => 'Y2lzY29zcGFyazovL3VzL1BFT1BMRS9lM2EyNjA4OC1hNmRiLTQxZjgtOTliMC1hNTEyMzkyYzAwOTg', | ||
'personEmail' => '[email protected]', | ||
'created' => '2015-12-04T17:33:56.767Z' | ||
] | ||
'created' => '2015-12-04T17:33:56.767Z', | ||
], | ||
]; | ||
} | ||
|
||
|
@@ -77,7 +77,7 @@ public function it_matches_the_request() | |
public function it_returns_the_message_object() | ||
{ | ||
$botResponseData = [ | ||
'id' => 'bot-id' | ||
'id' => 'bot-id', | ||
]; | ||
$botResponse = new Response(json_encode($botResponseData)); | ||
|
||
|
@@ -87,14 +87,14 @@ public function it_returns_the_message_object() | |
->with('https://api.ciscospark.com/v1/people/me', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($botResponse); | ||
|
||
$msgResponseData = [ | ||
'text' => 'Hi Julia', | ||
'roomId' => 'room-1234567890', | ||
'personId' => 'person-0987654321' | ||
'personId' => 'person-0987654321', | ||
]; | ||
$msgResponse = new Response(json_encode($msgResponseData)); | ||
|
||
|
@@ -103,7 +103,7 @@ public function it_returns_the_message_object() | |
->with('https://api.ciscospark.com/v1/messages/Y2lzY29zcGFyazovL3VzL01FU1NBR0UvMzIzZWUyZjAtOWFhZC0xMWU1LTg1YmYtMWRhZjhkNDJlZjlj', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($msgResponse); | ||
|
||
|
@@ -115,7 +115,7 @@ public function it_returns_the_message_object() | |
public function it_returns_the_message_text() | ||
{ | ||
$botResponseData = [ | ||
'id' => 'bot-id' | ||
'id' => 'bot-id', | ||
]; | ||
$botResponse = new Response(json_encode($botResponseData)); | ||
|
||
|
@@ -125,14 +125,14 @@ public function it_returns_the_message_text() | |
->with('https://api.ciscospark.com/v1/people/me', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($botResponse); | ||
|
||
$msgResponseData = [ | ||
'text' => 'Hi Julia', | ||
'roomId' => 'room-1234567890', | ||
'personId' => 'person-0987654321' | ||
'personId' => 'person-0987654321', | ||
]; | ||
$msgResponse = new Response(json_encode($msgResponseData)); | ||
|
||
|
@@ -141,7 +141,7 @@ public function it_returns_the_message_text() | |
->with('https://api.ciscospark.com/v1/messages/Y2lzY29zcGFyazovL3VzL01FU1NBR0UvMzIzZWUyZjAtOWFhZC0xMWU1LTg1YmYtMWRhZjhkNDJlZjlj', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($msgResponse); | ||
|
||
|
@@ -153,7 +153,7 @@ public function it_returns_the_message_text() | |
public function it_detects_bots() | ||
{ | ||
$botResponseData = [ | ||
'id' => 'bot-id' | ||
'id' => 'bot-id', | ||
]; | ||
$botResponse = new Response(json_encode($botResponseData)); | ||
|
||
|
@@ -163,14 +163,14 @@ public function it_detects_bots() | |
->with('https://api.ciscospark.com/v1/people/me', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($botResponse); | ||
|
||
$msgResponseData = [ | ||
'text' => 'Hi Julia', | ||
'roomId' => 'room-1234567890', | ||
'personId' => 'bot-id' | ||
'personId' => 'bot-id', | ||
]; | ||
$msgResponse = new Response(json_encode($msgResponseData)); | ||
|
||
|
@@ -179,7 +179,7 @@ public function it_detects_bots() | |
->with('https://api.ciscospark.com/v1/messages/Y2lzY29zcGFyazovL3VzL01FU1NBR0UvMzIzZWUyZjAtOWFhZC0xMWU1LTg1YmYtMWRhZjhkNDJlZjlj', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($msgResponse); | ||
|
||
|
@@ -191,7 +191,7 @@ public function it_detects_bots() | |
public function it_returns_the_user_id() | ||
{ | ||
$botResponseData = [ | ||
'id' => 'bot-id' | ||
'id' => 'bot-id', | ||
]; | ||
$botResponse = new Response(json_encode($botResponseData)); | ||
|
||
|
@@ -201,14 +201,14 @@ public function it_returns_the_user_id() | |
->with('https://api.ciscospark.com/v1/people/me', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($botResponse); | ||
|
||
$msgResponseData = [ | ||
'text' => 'Hi Julia', | ||
'roomId' => 'room-1234567890', | ||
'personId' => 'person-0987654321' | ||
'personId' => 'person-0987654321', | ||
]; | ||
$msgResponse = new Response(json_encode($msgResponseData)); | ||
|
||
|
@@ -217,7 +217,7 @@ public function it_returns_the_user_id() | |
->with('https://api.ciscospark.com/v1/messages/Y2lzY29zcGFyazovL3VzL01FU1NBR0UvMzIzZWUyZjAtOWFhZC0xMWU1LTg1YmYtMWRhZjhkNDJlZjlj', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($msgResponse); | ||
|
||
|
@@ -229,7 +229,7 @@ public function it_returns_the_user_id() | |
public function it_returns_the_channel_id() | ||
{ | ||
$botResponseData = [ | ||
'id' => 'bot-id' | ||
'id' => 'bot-id', | ||
]; | ||
$botResponse = new Response(json_encode($botResponseData)); | ||
|
||
|
@@ -239,14 +239,14 @@ public function it_returns_the_channel_id() | |
->with('https://api.ciscospark.com/v1/people/me', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($botResponse); | ||
|
||
$msgResponseData = [ | ||
'text' => 'Hi Julia', | ||
'roomId' => 'room-1234567890', | ||
'personId' => 'person-0987654321' | ||
'personId' => 'person-0987654321', | ||
]; | ||
$msgResponse = new Response(json_encode($msgResponseData)); | ||
|
||
|
@@ -255,7 +255,7 @@ public function it_returns_the_channel_id() | |
->with('https://api.ciscospark.com/v1/messages/Y2lzY29zcGFyazovL3VzL01FU1NBR0UvMzIzZWUyZjAtOWFhZC0xMWU1LTg1YmYtMWRhZjhkNDJlZjlj', [], [ | ||
'Accept:application/json', | ||
'Content-Type:application/json', | ||
'Authorization:Bearer my-token' | ||
'Authorization:Bearer my-token', | ||
]) | ||
->andReturn($msgResponse); | ||
|
||
|
@@ -272,16 +272,16 @@ public function it_is_configured() | |
|
||
$driver = new CiscoSparkDriver($request, [ | ||
'cisco-spark' => [ | ||
'token' => 'token' | ||
] | ||
'token' => 'token', | ||
], | ||
], $htmlInterface); | ||
|
||
$this->assertTrue($driver->isConfigured()); | ||
|
||
$driver = new CiscoSparkDriver($request, [ | ||
'cisco-spark' => [ | ||
'token' => null | ||
] | ||
'token' => null, | ||
], | ||
], $htmlInterface); | ||
|
||
$this->assertFalse($driver->isConfigured()); | ||
|