update 1.0.8.0

Commits for version update
This commit is contained in:
Manish Verma
2016-10-17 12:02:27 +05:30
parent dec927987b
commit 76e85db070
9674 changed files with 495757 additions and 58922 deletions

View File

@@ -23,13 +23,10 @@ class ResponseTest extends FCMTestCase {
$client = Mockery::mock(Client::class);
$client->shouldReceive('post')->once()->andReturn($response);
$this->app->singleton('fcm.client', function($app) use($client) {
return $client;
});
$tokens = 'uniqueToken';
$fcm = new FCMSender();
$fcm = new FCMSender($client, 'http://test.test');
$fcm->sendTo($tokens);
}
@@ -56,16 +53,41 @@ class ResponseTest extends FCMTestCase {
$client = Mockery::mock(Client::class);
$client->shouldReceive('post')->times(10)->andReturn($response);
$this->app->singleton('fcm.client', function($app) use($client) {
return $client;
});
$tokens = [];
for ($i=0 ; $i<10000 ; $i++) {
$tokens[$i] = 'token_'.$i;
}
$fcm = new FCMSender();
$fcm = new FCMSender($client, 'http://test.test');
$fcm->sendTo($tokens);
}
/**
* @test
*/
public function an_empty_array_of_tokens_thrown_an_exception()
{
$response = new Response(400, [], '{
"multicast_id": 216,
"success": 3,
"failure": 3,
"canonical_ids": 1,
"results": [
{ "message_id": "1:0408" },
{ "error": "Unavailable" },
{ "error": "InvalidRegistration" },
{ "message_id": "1:1516" },
{ "message_id": "1:2342", "registration_id": "32" },
{ "error": "NotRegistered"}
]
}' );
$client = Mockery::mock(Client::class);
$client->shouldReceive('post')->once()->andReturn($response);
$fcm = new FCMSender($client, 'http://test.test');
$this->setExpectedException(\LaravelFCM\Response\Exceptions\InvalidRequestException::class);
$fcm->sendTo([]);
}
}