Skip to content

Commit

Permalink
Merge branch 'master' of github.com:botman/driver-telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot committed Mar 2, 2018
2 parents c35e316 + a4c86fc commit 64f2891
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/TelegramDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ protected function isValidLoginRequest()
// Get sorted array of values
$check = $this->queryParameters
->except('hash')
->map(function($value, $key) {
return $key . '=' . $value;
->map(function ($value, $key) {
return $key.'='.$value;
})
->values()
->sort();
Expand Down
38 changes: 19 additions & 19 deletions tests/TelegramDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Tests;

use Illuminate\Support\Collection;
use Mockery as m;
use BotMan\BotMan\Http\Curl;
use BotMan\BotMan\Users\User;
use PHPUnit_Framework_TestCase;
use Illuminate\Support\Collection;
use BotMan\Drivers\Telegram\TelegramDriver;
use BotMan\BotMan\Messages\Attachments\File;
use BotMan\BotMan\Messages\Attachments\Audio;
Expand Down Expand Up @@ -219,14 +219,14 @@ public function it_calls_telegram_login_event()
'last_name' => 'Pociot',
'username' => 'marcelpociot',
'photo_url' => 'https://some/picture.jpg',
'auth_date' => time()
'auth_date' => time(),
];

// Calculate hash
$check = Collection::make($queryParameters)
->except('hash')
->map(function($value, $key) {
return $key . '=' . $value;
->map(function ($value, $key) {
return $key.'='.$value;
})
->values()
->sort();
Expand All @@ -241,8 +241,8 @@ public function it_calls_telegram_login_event()

$driver = new TelegramDriver($request, [
'telegram' => [
'token' => $token
]
'token' => $token,
],
], m::mock(Curl::class));

$event = $driver->hasMatchingEvent();
Expand All @@ -266,14 +266,14 @@ public function it_does_not_call_telegram_login_event_with_outdated_auth_date()
'last_name' => 'Pociot',
'username' => 'marcelpociot',
'photo_url' => 'https://some/picture.jpg',
'auth_date' => time() - 90000
'auth_date' => time() - 90000,
];

// Calculate hash
$check = Collection::make($queryParameters)
->except('hash')
->map(function($value, $key) {
return $key . '=' . $value;
->map(function ($value, $key) {
return $key.'='.$value;
})
->values()
->sort();
Expand All @@ -288,8 +288,8 @@ public function it_does_not_call_telegram_login_event_with_outdated_auth_date()

$driver = new TelegramDriver($request, [
'telegram' => [
'token' => $token
]
'token' => $token,
],
], m::mock(Curl::class));

$this->assertFalse($driver->hasMatchingEvent());
Expand All @@ -307,15 +307,15 @@ public function it_does_not_call_telegram_login_event_with_invalid_hash()
'username' => 'marcelpociot',
'photo_url' => 'https://some/picture.jpg',
'auth_date' => time(),
'hash' => 'kajhsdkjhaskjdh'
'hash' => 'kajhsdkjhaskjdh',
];

$request = new Request($queryParameters);

$driver = new TelegramDriver($request, [
'telegram' => [
'token' => $token
]
'token' => $token,
],
], m::mock(Curl::class));

$this->assertFalse($driver->hasMatchingEvent());
Expand All @@ -332,14 +332,14 @@ public function telegram_login_event_has_the_correct_chat_id()
'last_name' => 'Pociot',
'username' => 'marcelpociot',
'photo_url' => 'https://some/picture.jpg',
'auth_date' => time()
'auth_date' => time(),
];

// Calculate hash
$check = Collection::make($queryParameters)
->except('hash')
->map(function($value, $key) {
return $key . '=' . $value;
->map(function ($value, $key) {
return $key.'='.$value;
})
->values()
->sort();
Expand All @@ -354,8 +354,8 @@ public function telegram_login_event_has_the_correct_chat_id()

$driver = new TelegramDriver($request, [
'telegram' => [
'token' => $token
]
'token' => $token,
],
], m::mock(Curl::class));

$message = $driver->getMessages();
Expand Down

0 comments on commit 64f2891

Please sign in to comment.