| @@ 196-225 (lines=30) @@ | ||
| 193 | $client->accounts()->getAccountInfo(['uid' => $uid]); |
|
| 194 | } |
|
| 195 | ||
| 196 | public function testUidSignatureWhenInvalidSignatureThrowsAnException() |
|
| 197 | { |
|
| 198 | $uid = 'diofu90ifgdf'; |
|
| 199 | $timestamp = time(); |
|
| 200 | ||
| 201 | $body = sprintf( |
|
| 202 | '{ |
|
| 203 | "UID": "%s", |
|
| 204 | "UIDSignature": "%s", |
|
| 205 | "signatureTimestamp": "%d", |
|
| 206 | "statusCode": 200, |
|
| 207 | "errorCode": 0, |
|
| 208 | "statusReason": "OK", |
|
| 209 | "callId": "123456", |
|
| 210 | "time": "2015-03-22T11:42:25.943Z" |
|
| 211 | }', |
|
| 212 | $uid, |
|
| 213 | 'invalid', |
|
| 214 | $timestamp |
|
| 215 | ); |
|
| 216 | ||
| 217 | $client = new Gigya('key', 'secret'); |
|
| 218 | $this->setUpGigyaHistory($client, $body); |
|
| 219 | ||
| 220 | static::setExpectedException( |
|
| 221 | InvalidUidSignatureException::class |
|
| 222 | ); |
|
| 223 | ||
| 224 | $client->accounts()->getAccountInfo(['uid' => $uid]); |
|
| 225 | } |
|
| 226 | ||
| 227 | public function testRequestWillThrowTimestampExceptionWhenBothTimestampAndSignatureAreInvalid() |
|
| 228 | { |
|
| @@ 227-256 (lines=30) @@ | ||
| 224 | $client->accounts()->getAccountInfo(['uid' => $uid]); |
|
| 225 | } |
|
| 226 | ||
| 227 | public function testRequestWillThrowTimestampExceptionWhenBothTimestampAndSignatureAreInvalid() |
|
| 228 | { |
|
| 229 | $uid = 'diofu90ifgdf'; |
|
| 230 | $timestamp = time() - 181; |
|
| 231 | ||
| 232 | $body = sprintf( |
|
| 233 | '{ |
|
| 234 | "UID": "%s", |
|
| 235 | "UIDSignature": "%s", |
|
| 236 | "signatureTimestamp": "%d", |
|
| 237 | "statusCode": 200, |
|
| 238 | "errorCode": 0, |
|
| 239 | "statusReason": "OK", |
|
| 240 | "callId": "123456", |
|
| 241 | "time": "2015-03-22T11:42:25.943Z" |
|
| 242 | }', |
|
| 243 | $uid, |
|
| 244 | 'invalid', |
|
| 245 | $timestamp |
|
| 246 | ); |
|
| 247 | ||
| 248 | $client = new Gigya('key', 'secret'); |
|
| 249 | $this->setUpGigyaHistory($client, $body); |
|
| 250 | ||
| 251 | static::setExpectedException( |
|
| 252 | InvalidTimestampException::class |
|
| 253 | ); |
|
| 254 | ||
| 255 | $client->accounts()->getAccountInfo(['uid' => $uid]); |
|
| 256 | } |
|
| 257 | ||
| 258 | public function testGigyaWillTriggerSubscriberOnlyWhenItIsAddedInARequest() |
|
| 259 | { |
|