Skip to content

Commit

Permalink
Apply fixes from StyleCI (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot authored Sep 20, 2017
1 parent 636c8c2 commit cc10167
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/NexmoDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
46 changes: 23 additions & 23 deletions tests/NexmoDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -180,7 +180,7 @@ public function it_is_configured()
'nexmo' => [
'app_key' => 'key',
'app_secret' => 'secret',
]
],
], $htmlInterface);
$this->assertTrue($driver->isConfigured());
}
Expand All @@ -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);
}

Expand All @@ -246,21 +246,21 @@ public function it_can_send_payload()
'nexmo' => [
'app_key' => 'key',
'app_secret' => 'secret',
]
],
], $htmlInterface);

$payload = [
'api_key' => 'key',
'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);
}

Expand All @@ -275,27 +275,27 @@ public function it_can_send_requests()
'nexmo' => [
'app_key' => 'key',
'app_secret' => 'secret',
]
],
], $htmlInterface);

$parameters = [
'to' => '123456',
'from' => '987654',
'text' => 'string'
'text' => 'string',
];

$payload = [
'api_key' => 'key',
'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);
}
Expand All @@ -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);

Expand Down

0 comments on commit cc10167

Please sign in to comment.