Completed
Push — develop ( 36cc8a...37c323 )
by Christoffer
02:11
created

OAuth2ServiceTest::validateAccessToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Nord\Lumen\OAuth2\Tests;
4
5
use Helper\Unit;
6
use Nord\Lumen\OAuth2\OAuth2Service;
7
8
class OAuth2ServiceTest extends \Codeception\Test\Unit
9
{
10
    use \Codeception\Specify;
11
12
    /**
13
     * @var OAuth2Service
14
     */
15
    private $service;
16
17
    /**
18
     * @inheritdoc
19
     */
20
    protected function setup()
21
    {
22
        Unit::setAuthorizationHeader();
23
        $this->service = new OAuth2Service(Unit::createAuthorizationServer(), Unit::createResourceServer());
24
    }
25
26
    /**
27
     *
28
     */
29
    public function testAssertIssueAccessToken()
30
    {
31
        $this->specify('verify service issueAccessToken', function () {
32
            verify($this->service->issueAccessToken())->equals(MockAccessToken::toArray());
33
        });
34
    }
35
36
    /**
37
     *
38
     */
39
    public function testAssertValidateAccessToken()
40
    {
41
        $this->specify('verify service validateAccessToken', function () {
42
            verify($this->service->validateAccessToken())->true();
43
        });
44
    }
45
46
    /**
47
     *
48
     */
49
    public function testAssertGetResourceOwnerId()
50
    {
51
        $this->specify('verify service can getResourceOwnerId', function () {
52
            $this->service->validateAccessToken();
53
            verify($this->service->getResourceOwnerId())->equals('test');
54
        });
55
    }
56
57
    /**
58
     *
59
     */
60
    public function testAssertGetResourceOwnerType()
61
    {
62
        $this->specify('verify service can getResourceOwnerType', function () {
63
            $this->service->validateAccessToken();
64
            verify($this->service->getResourceOwnerType())->equals('test');
65
        });
66
    }
67
68
    /**
69
     *
70
     */
71
    public function testAssertGetClientId()
72
    {
73
        $this->specify('verify service can getClientId', function () {
74
            $this->service->validateAccessToken();
75
            verify($this->service->getClientId())->equals('test');
76
        });
77
    }
78
}
79