1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of graze/gigya-client |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
* |
10
|
|
|
* @license https://github.com/graze/gigya-client/blob/master/LICENSE.md |
11
|
|
|
* @link https://github.com/graze/gigya-client |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Graze\Gigya\Test\Unit\Response; |
15
|
|
|
|
16
|
|
|
use Graze\Gigya\Response\ErrorCode; |
17
|
|
|
use Graze\Gigya\Test\TestCase; |
18
|
|
|
|
19
|
|
|
class ErrorCodeTest extends TestCase |
20
|
|
|
{ |
21
|
|
|
public function testGetName() |
22
|
|
|
{ |
23
|
|
|
static::assertEquals('Session migration error', ErrorCode::getName(ErrorCode::ERROR_SESSION_MIGRATION_ERROR)); |
24
|
|
|
static::assertEquals('Invalid Secret', ErrorCode::getName(ErrorCode::ERROR_INVALID_SECRET)); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testGetNameWithUnknownErrorCodeWillReturnNull() |
28
|
|
|
{ |
29
|
|
|
static::assertNull(ErrorCode::getName(3271863217367182)); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testGetDescription() |
33
|
|
|
{ |
34
|
|
|
static::assertEquals( |
35
|
|
|
'When accounts.login, accounts.socialLogin, accounts.finalizeRegistration, socialize.notifyLogin, or socialize.login is called and the policy (in the site Policies) requires 2-factor authentication, and the device is not already in the verified device list for the account. The first time the method is called, the device needs to be registered, and for the following calls, the device needs to be verified.', |
36
|
|
|
ErrorCode::getDescription(ErrorCode::ERROR_ACCOUNT_PENDING_TFA_VERIFICATION) |
37
|
|
|
); |
38
|
|
|
static::assertEquals( |
39
|
|
|
'If Protect Against Account Harvesting policy is enabled and neither Email Validation nor CAPTCHA Validation policies are enabled.', |
40
|
|
|
ErrorCode::getDescription(ErrorCode::ERROR_INVALID_POLICY_CONFIGURATION) |
41
|
|
|
); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function testGetDescriptionWithUnknownErrorCodeWillReturnNull() |
45
|
|
|
{ |
46
|
|
|
static::assertNull(ErrorCode::getDescription(3271863217367182)); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|