Skip to content

Latest commit

 

History

History
254 lines (101 loc) · 4.61 KB

LaravelFCM-Test-Mocks-MockDownstreamResponse.md

File metadata and controls

254 lines (101 loc) · 4.61 KB

LaravelFCM\Test\Mocks\MockDownstreamResponse

Class MockDownstreamResponse Only use it for testing

Methods

__construct

mixed LaravelFCM\Test\Mocks\MockDownstreamResponse::__construct($numberSuccess)

DownstreamResponse constructor.

  • Visibility: public

Arguments

  • $numberSuccess mixed

merge

mixed LaravelFCM\Response\DownstreamResponseContract::merge(\LaravelFCM\Response\DownstreamResponse $response)

Merge two response

Arguments

numberSuccess

integer LaravelFCM\Response\DownstreamResponseContract::numberSuccess()

Get the number of device reached with success

numberFailure

integer LaravelFCM\Response\DownstreamResponseContract::numberFailure()

Get the number of device which thrown an error

numberModification

integer LaravelFCM\Response\DownstreamResponseContract::numberModification()

Get the number of device that you need to modify their token

addTokenToDelete

mixed LaravelFCM\Test\Mocks\MockDownstreamResponse::addTokenToDelete($token)

Add a token to delete

  • Visibility: public

Arguments

  • $token mixed

tokensToDelete

array LaravelFCM\Response\DownstreamResponseContract::tokensToDelete()

get token to delete

remove all tokens returned by this method in your database

addTokenToModify

mixed LaravelFCM\Test\Mocks\MockDownstreamResponse::addTokenToModify($oldToken, $newToken)

Add a token to modify

  • Visibility: public

Arguments

  • $oldToken mixed
  • $newToken mixed

tokensToModify

array LaravelFCM\Response\DownstreamResponseContract::tokensToModify()

get token to modify

key: oldToken value: new token

find the old token in your database and replace it with the new one

addTokenToRetry

mixed LaravelFCM\Test\Mocks\MockDownstreamResponse::addTokenToRetry($token)

Add a token to retry

  • Visibility: public

Arguments

  • $token mixed

tokensToRetry

array LaravelFCM\Response\DownstreamResponseContract::tokensToRetry()

Get tokens that you should resend using exponential backoof

addTokenWithError

mixed LaravelFCM\Test\Mocks\MockDownstreamResponse::addTokenWithError($token, $message)

Add a token to errors

  • Visibility: public

Arguments

  • $token mixed
  • $message mixed

tokensWithError

array LaravelFCM\Response\DownstreamResponseContract::tokensWithError()

Get tokens that thrown an error

key : token value : error

In production, remove these tokens from you database

setMissingToken

mixed LaravelFCM\Test\Mocks\MockDownstreamResponse::setMissingToken($hasMissingToken)

change missing token state

  • Visibility: public

Arguments

  • $hasMissingToken mixed

hasMissingToken

boolean LaravelFCM\Response\DownstreamResponseContract::hasMissingToken()

check if missing tokens was given to the request If true, remove all the empty token in your database