GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

JoseHeaderAccessorTest   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 76
rs 10
c 0
b 0
f 0
wmc 9
lcom 1
cbo 4

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A testCanGetInstance() 0 4 1
A testCanGetAlgorithmDirective() 0 6 1
A testCanGetJwkSetUrlDirective() 0 5 1
A testCanGetKeyID() 0 5 1
A testCanGetX509Url() 0 5 1
A testCanGetType() 0 6 1
A testCanGetContentType() 0 6 1
A testCanGetAll() 0 6 1
1
<?php
2
3
namespace Gandung\JWT\Tests\Accessor;
4
5
use PHPUnit\Framework\TestCase;
6
use Gandung\JWT\Accessor\JoseHeaderAccessor;
7
use Gandung\JWT\JWTFactory;
8
use Gandung\JWT\Token\JoseBuilderInterface;
9
10
/**
11
 * @author Paulus Gandung Prakosa <[email protected]>
12
 */
13
class JoseHeaderAccessorTest extends TestCase
14
{
15
    /**
16
     * @var JoseBuilderInterface
17
     */
18
    private $jose;
19
20
    public function __construct()
21
    {
22
        parent::__construct();
23
        $this->jose = JWTFactory::getJoseBuilder()
24
            ->algorithm(\Gandung\JWT\Token\Algorithm::HS256)
25
            ->type('JWT')
26
            ->contentType('application/json');
27
    }
28
29
    public function testCanGetInstance()
30
    {
31
        $this->assertInstanceOf(JoseHeaderAccessor::class, new JoseHeaderAccessor($this->jose->getValue()));
32
    }
33
34
    public function testCanGetAlgorithmDirective()
35
    {
36
        $accessor = new JoseHeaderAccessor($this->jose->getValue());
37
        $this->assertInternalType('string', $accessor->getAlgorithm());
38
        $this->assertEquals(\Gandung\JWT\Token\Algorithm::HS256, $accessor->getAlgorithm());
39
    }
40
41
    /**
42
     * @expectedException \RuntimeException
43
     */
44
    public function testCanGetJwkSetUrlDirective()
45
    {
46
        $accessor = new JoseHeaderAccessor($this->jose->getValue());
47
        $this->assertInternalType('string', $accessor->getJwkSetUrl());
48
    }
49
50
    /**
51
     * @expectedException \RuntimeException
52
     */
53
    public function testCanGetKeyID()
54
    {
55
        $accessor = new JoseHeaderAccessor($this->jose->getValue());
56
        $this->assertInternalType('string', $accessor->getKeyID());
57
    }
58
59
    /**
60
     * @expectedException \RuntimeException
61
     */
62
    public function testCanGetX509Url()
63
    {
64
        $accessor = new JoseHeaderAccessor($this->jose->getValue());
65
        $this->assertInternalType('string', $accessor->getX509Url());
66
    }
67
68
    public function testCanGetType()
69
    {
70
        $accessor = new JoseHeaderAccessor($this->jose->getValue());
71
        $this->assertInternalType('string', $accessor->getType());
72
        $this->assertEquals('JWT', $accessor->getType());
73
    }
74
75
    public function testCanGetContentType()
76
    {
77
        $accessor = new JoseHeaderAccessor($this->jose->getValue());
78
        $this->assertInternalType('string', $accessor->getContentType());
79
        $this->assertEquals('application/json', $accessor->getContentType());
80
    }
81
82
    public function testCanGetAll()
83
    {
84
        $accessor = new JoseHeaderAccessor($this->jose->getValue());
85
        $this->assertInternalType('array', $accessor->get());
86
        $this->assertNotEmpty($accessor->getContentType());
87
    }
88
}
89