From cc101676d217007b8457bd4c9d4a1363c4a45f11 Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Wed, 20 Sep 2017 22:04:28 +0200 Subject: [PATCH] Apply fixes from StyleCI (#3) --- src/NexmoDriver.php | 1 + tests/NexmoDriverTest.php | 46 +++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/NexmoDriver.php b/src/NexmoDriver.php index a68c896..b77c0ae 100644 --- a/src/NexmoDriver.php +++ b/src/NexmoDriver.php @@ -66,6 +66,7 @@ public function getMessages() new IncomingMessage($this->event->get('text'), $this->event->get('msisdn'), $this->event->get('to'), $this->payload), ]; } + return $this->messages; } diff --git a/tests/NexmoDriverTest.php b/tests/NexmoDriverTest.php index 5e33fc6..a61529f 100644 --- a/tests/NexmoDriverTest.php +++ b/tests/NexmoDriverTest.php @@ -2,14 +2,14 @@ namespace Tests; -use BotMan\BotMan\Http\Curl; -use BotMan\BotMan\Messages\Incoming\IncomingMessage; -use BotMan\BotMan\Messages\Outgoing\OutgoingMessage; -use BotMan\BotMan\Messages\Outgoing\Question; -use BotMan\Drivers\Nexmo\NexmoDriver; use Mockery as m; +use BotMan\BotMan\Http\Curl; use PHPUnit_Framework_TestCase; +use BotMan\Drivers\Nexmo\NexmoDriver; +use BotMan\BotMan\Messages\Outgoing\Question; use Symfony\Component\HttpFoundation\Request; +use BotMan\BotMan\Messages\Incoming\IncomingMessage; +use BotMan\BotMan\Messages\Outgoing\OutgoingMessage; class NexmoDriverTest extends PHPUnit_Framework_TestCase { @@ -180,7 +180,7 @@ public function it_is_configured() 'nexmo' => [ 'app_key' => 'key', 'app_secret' => 'secret', - ] + ], ], $htmlInterface); $this->assertTrue($driver->isConfigured()); } @@ -196,42 +196,42 @@ public function it_can_build_payload() 'nexmo' => [ 'app_key' => 'key', 'app_secret' => 'secret', - ] + ], ], $htmlInterface); - + $incomingMessage = new IncomingMessage('text', '123456', '987654'); $message = 'string'; $payload = $driver->buildServicePayload($message, $incomingMessage); - + $this->assertSame([ 'api_key' => 'key', 'api_secret' => 'secret', 'to' => '123456', 'from' => '987654', - 'text' => 'string' + 'text' => 'string', ], $payload); $message = new OutgoingMessage('message object'); $payload = $driver->buildServicePayload($message, $incomingMessage); - + $this->assertSame([ 'api_key' => 'key', 'api_secret' => 'secret', 'to' => '123456', 'from' => '987654', - 'text' => 'message object' + 'text' => 'message object', ], $payload); $message = new Question('question object'); $payload = $driver->buildServicePayload($message, $incomingMessage); - + $this->assertSame([ 'api_key' => 'key', 'api_secret' => 'secret', 'to' => '123456', 'from' => '987654', - 'text' => 'question object' + 'text' => 'question object', ], $payload); } @@ -246,7 +246,7 @@ public function it_can_send_payload() 'nexmo' => [ 'app_key' => 'key', 'app_secret' => 'secret', - ] + ], ], $htmlInterface); $payload = [ @@ -254,13 +254,13 @@ public function it_can_send_payload() 'api_secret' => 'secret', 'to' => '123456', 'from' => '987654', - 'text' => 'string' + 'text' => 'string', ]; $htmlInterface->shouldReceive('post') ->once() ->with('https://rest.nexmo.com/sms/json?'.http_build_query($payload)); - + $driver->sendPayload($payload); } @@ -275,13 +275,13 @@ public function it_can_send_requests() 'nexmo' => [ 'app_key' => 'key', 'app_secret' => 'secret', - ] + ], ], $htmlInterface); $parameters = [ 'to' => '123456', 'from' => '987654', - 'text' => 'string' + 'text' => 'string', ]; $payload = [ @@ -289,13 +289,13 @@ public function it_can_send_requests() 'api_secret' => 'secret', 'to' => '123456', 'from' => '987654', - 'text' => 'string' + 'text' => 'string', ]; $htmlInterface->shouldReceive('post') ->once() ->with('https://rest.nexmo.com/foo/json?'.http_build_query($payload)); - + $incomingMessage = new IncomingMessage('text', '123456', '987654'); $driver->sendRequest('foo/json', $payload, $incomingMessage); } @@ -311,9 +311,9 @@ public function it_can_get_conversation_answers() 'nexmo' => [ 'app_key' => 'key', 'app_secret' => 'secret', - ] + ], ], $htmlInterface); - + $incomingMessage = new IncomingMessage('text', '123456', '987654'); $answer = $driver->getConversationAnswer($incomingMessage);