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.

testCanGetRelatedToDirective()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Gandung\JWT\Tests\Accessor;
4
5
use PHPUnit\Framework\TestCase;
6
use Gandung\JWT\Accessor\PayloadAccessor;
7
use Gandung\JWT\Token\PayloadBuilderInterface;
8
use Gandung\JWT\JWTFactory;
9
10
/**
11
 * @author Paulus Gandung Prakosa <[email protected]>
12
 */
13
class PayloadAccessorTest extends TestCase
14
{
15
    /**
16
     * @var PayloadBuilderInterface
17
     */
18
    private $payload;
19
20
    public function __construct()
21
    {
22
        parent::__construct();
23
        $claim = JWTFactory::getClaimBuilder()
0 ignored issues
show
Bug introduced by
The method expireAt cannot be called on \Gandung\JWT\JWTFactory:...ilder()->issuedBy('me') (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
24
            ->issuedBy('me')
25
            ->expireAt(new \DateTimeImmutable('@' . (time() + 3600)));
26
        $this->payload = JWTFactory::getPayloadBuilder()
27
            ->claim($claim)
28
            ->userData([
29
                'credentials' => [
30
                    'username' => 'me',
31
                    'password' => 'this_is_only_me_will_know'
32
                ]
33
            ]);
34
    }
35
36
    public function testCanGetInstance()
37
    {
38
        $this->assertInstanceOf(PayloadAccessor::class, new PayloadAccessor($this->payload->getValue()));
39
    }
40
41
    public function testCanGetIssuedByDirective()
42
    {
43
        $accessor = new PayloadAccessor($this->payload->getValue());
44
        $this->assertInternalType('string', $accessor->getIssuedBy());
45
        $this->assertEquals('me', $accessor->getIssuedBy());
46
    }
47
48
    /**
49
     * @expectedException \RuntimeException
50
     */
51
    public function testCanGetRelatedToDirective()
52
    {
53
        $accessor = new PayloadAccessor($this->payload->getValue());
54
        $this->assertInternalType('string', $accessor->getRelatedTo());
55
    }
56
57
    /**
58
     * @expectedException \RuntimeException
59
     */
60
    public function testCanGetIntendedForDirective()
61
    {
62
        $accessor = new PayloadAccessor($this->payload->getValue());
63
        $this->assertInternalType('string', $accessor->getIntendedFor());
64
    }
65
66
    public function testCanGetExpireAtDirective()
67
    {
68
        $accessor = new PayloadAccessor($this->payload->getValue());
69
        $this->assertInstanceOf(\DateTimeImmutable::class, $accessor->getExpireAt());
70
    }
71
72
    /**
73
     * @expectedException \RuntimeException
74
     */
75
    public function testCanGetCanOnlyBeUsedAfterDirective()
76
    {
77
        $accessor = new PayloadAccessor($this->payload->getValue());
78
        $this->assertInstanceOf(\DateTimeImmutable::class, $accessor->getCanOnlyBeUsedAfter());
79
    }
80
81
    /**
82
     * @expectedException \RuntimeException
83
     */
84
    public function testCanGetIssuedAtDirective()
85
    {
86
        $accessor = new PayloadAccessor($this->payload->getValue());
87
        $this->assertInstanceOf(\DateTimeImmutable::class, $accessor->getIssuedAt());
88
    }
89
90
    /**
91
     * @expectedException \RuntimeException
92
     */
93
    public function testCanGetIdentifiedByDirective()
94
    {
95
        $accessor = new PayloadAccessor($this->payload->getValue());
96
        $this->assertInstanceOf(\DateTimeImmutable::class, $accessor->getIdentifiedBy());
97
    }
98
99
    public function testCanGetAll()
100
    {
101
        $accessor = new PayloadAccessor($this->payload->getValue());
102
        $this->assertInternalType('array', $accessor->get());
103
        $this->assertNotEmpty($accessor->get());
104
    }
105
}
106