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.

ES256Test::testCanSignGivenData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Gandung\JWT\Tests\Algorithm\ECDSA;
4
5
use PHPUnit\Framework\TestCase;
6
use Gandung\JWT\Adapter\ECDSAAdapter;
7
use Gandung\JWT\Algorithm\ECDSA\ES256;
8
use Gandung\JWT\Manager\KeyManager;
9
10
/**
11
 * @author Paulus Gandung Prakosa <[email protected]>
12
 */
13
class ES256Test extends TestCase
14
{
15
    public function testCanGetInstance()
16
    {
17
        $this->assertInstanceOf(ES256::class, new ES256(ECDSAAdapter::create()));
18
    }
19
20
    public function testCanSignGivenData()
21
    {
22
        $key = new KeyManager;
23
        $key->setContentFromCertFile('cert/secp256.pem');
24
        $es256 = new ES256(ECDSAAdapter::create());
25
        $signature = $es256->sign('this is a text.', $key);
26
        $this->assertInternalType('string', $signature);
27
        $this->assertNotEmpty($signature);
28
    }
29
30
    public function testCanVerifySignature()
31
    {
32
        $key = new KeyManager;
33
        $key->setContentFromCertFile('cert/secp256.pem');
34
        $es256 = new ES256(ECDSAAdapter::create());
35
        $signature = $es256->sign('this is a text.', $key);
36
        $this->assertInternalType('string', $signature);
37
        $this->assertNotEmpty($signature);
38
        $key->setContentFromCertFile('cert/secp256.pub.pem');
39
        $isSignatureMatched = $es256->verify($signature, 'this is a text.', $key);
40
        $this->assertInternalType('boolean', $isSignatureMatched);
41
        $this->assertTrue($isSignatureMatched);
42
    }
43
44
    public function testCanGetAlgorithmAlias()
45
    {
46
        $es256 = new ES256(ECDSAAdapter::create());
47
        $this->assertEquals(\Gandung\JWT\Token\Algorithm::ES256, $es256->getAlgorithmAlias());
48
    }
49
}
50