Skip to content

Commit

Permalink
Apply fixes from StyleCI (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot authored Jul 23, 2017
1 parent b68bb36 commit ac3be82
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
18 changes: 9 additions & 9 deletions src/CiscoSparkDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

namespace BotMan\Drivers\CiscoSpark;

use BotMan\BotMan\Users\User;
use Illuminate\Support\Collection;
use BotMan\BotMan\Drivers\HttpDriver;
use BotMan\BotMan\Messages\Attachments\Location;
use BotMan\BotMan\Messages\Incoming\Answer;
use BotMan\BotMan\Messages\Incoming\IncomingMessage;
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
use BotMan\BotMan\Messages\Outgoing\Question;
use BotMan\BotMan\Users\User;
use Illuminate\Support\Collection;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use BotMan\BotMan\Messages\Attachments\Location;
use Symfony\Component\HttpFoundation\ParameterBag;
use BotMan\BotMan\Messages\Incoming\IncomingMessage;
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;

class CiscoSparkDriver extends HttpDriver
{
Expand Down Expand Up @@ -41,7 +41,7 @@ protected function getHeaders()
return [
'Accept:application/json',
'Content-Type:application/json',
'Authorization:Bearer '.$this->config->get('token')
'Authorization:Bearer '.$this->config->get('token'),
];
}

Expand All @@ -52,7 +52,7 @@ protected function getHeaders()
*/
public function matchesRequest()
{
return ! is_null($this->payload->get('actorId')) && $this->payload->get('resource') === 'messages' && $this->payload->get('event') === 'created';
return ! is_null($this->payload->get('actorId')) && $this->payload->get('resource') === 'messages' && $this->payload->get('event') === 'created';
}

/**
Expand Down Expand Up @@ -174,7 +174,7 @@ public function sendRequest($endpoint, array $parameters, IncomingMessage $match
}

/**
* Returns the chatbot ID
* Returns the chatbot ID.
* @return string
*/
private function getBotId()
Expand Down
2 changes: 1 addition & 1 deletion stubs/cisco-spark.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
|
*/
'secret' => env('CISCO_SPARK_SECRET'),
];
];
60 changes: 30 additions & 30 deletions tests/CiscoSparkDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -20,8 +20,8 @@ private function getDriver($responseData, $htmlInterface = null)

return new CiscoSparkDriver($request, [
'cisco-spark' => [
'token' => 'my-token'
]
'token' => 'my-token',
],
], $htmlInterface);
}

Expand All @@ -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',
],
];
}

Expand Down Expand Up @@ -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));

Expand All @@ -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));

Expand All @@ -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);

Expand All @@ -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));

Expand All @@ -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));

Expand All @@ -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);

Expand All @@ -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));

Expand All @@ -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));

Expand All @@ -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);

Expand All @@ -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));

Expand All @@ -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));

Expand All @@ -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);

Expand All @@ -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));

Expand All @@ -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));

Expand All @@ -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);

Expand All @@ -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());
Expand Down

0 comments on commit ac3be82

Please sign in to comment.