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\Auth\OAuth2; |
15
|
|
|
|
16
|
|
|
use Graze\Gigya\Auth\OAuth2\AccessToken; |
17
|
|
|
use Graze\Gigya\Auth\OAuth2\GrantInterface; |
18
|
|
|
use Graze\Gigya\Auth\OAuth2\ManualGrant; |
19
|
|
|
use Graze\Gigya\Test\TestCase; |
20
|
|
|
|
21
|
|
|
class ManualGrantTest extends TestCase |
22
|
|
|
{ |
23
|
|
|
public function testInstanceOf() |
24
|
|
|
{ |
25
|
|
|
$grant = new ManualGrant(); |
26
|
|
|
static::assertInstanceOf(GrantInterface::class, $grant); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function testConstructor() |
30
|
|
|
{ |
31
|
|
|
$grant = new ManualGrant(); |
32
|
|
|
static::assertNull($grant->getToken()); |
33
|
|
|
|
34
|
|
|
$token = new AccessToken('token'); |
35
|
|
|
$grant = new ManualGrant($token); |
36
|
|
|
static::assertSame($token, $grant->getToken()); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function testSetter() |
40
|
|
|
{ |
41
|
|
|
$grant = new ManualGrant(); |
42
|
|
|
static::assertNull($grant->getToken()); |
43
|
|
|
|
44
|
|
|
$token = new AccessToken('token'); |
45
|
|
|
static::assertSame($grant, $grant->setToken($token)); |
46
|
|
|
static::assertSame($token, $grant->getToken()); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|