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.

Code Duplication    Length = 40-40 lines in 3 locations

test/Algorithm/Rs256Test.php 1 location

@@ 5-44 (lines=40) @@
2
3
namespace Emarref\Jwt\Algorithm;
4
5
class Rs256Test extends \PHPUnit_Framework_TestCase
6
{
7
    private static $name          = 'RS256';
8
    private static $algorithmName = 'sha256';
9
10
    /**
11
     * @var string
12
     */
13
    private $key;
14
15
    /**
16
     * @var Rs256
17
     */
18
    private $algorithm;
19
20
    public function setUp()
21
    {
22
        $this->key = openssl_pkey_new();
23
        $this->algorithm = new Rs256();
24
    }
25
26
    public function testGetName()
27
    {
28
        $this->assertSame(self::$name, $this->algorithm->getName());
29
    }
30
31
    public function testGetAlgorithm()
32
    {
33
        $this->assertSame(self::$algorithmName, $this->algorithm->getAlgorithm());
34
    }
35
36
    public function testSign()
37
    {
38
        $unencryptedValue = 'foobar';
39
        openssl_sign($unencryptedValue, $encryptedValue, $this->key, OPENSSL_ALGO_SHA256);
40
        $signature = $this->algorithm->sign($unencryptedValue, $this->key);
41
42
        $this->assertSame($encryptedValue, $signature);
43
    }
44
}
45

test/Algorithm/Rs384Test.php 1 location

@@ 5-44 (lines=40) @@
2
3
namespace Emarref\Jwt\Algorithm;
4
5
class Rs384Test extends \PHPUnit_Framework_TestCase
6
{
7
    private static $name          = 'RS384';
8
    private static $algorithmName = 'sha384';
9
10
    /**
11
     * @var string
12
     */
13
    private $key;
14
15
    /**
16
     * @var Rs384
17
     */
18
    private $algorithm;
19
20
    public function setUp()
21
    {
22
        $this->key = openssl_pkey_new();
23
        $this->algorithm = new Rs384();
24
    }
25
26
    public function testGetName()
27
    {
28
        $this->assertSame(self::$name, $this->algorithm->getName());
29
    }
30
31
    public function testGetAlgorithm()
32
    {
33
        $this->assertSame(self::$algorithmName, $this->algorithm->getAlgorithm());
34
    }
35
36
    public function testSign()
37
    {
38
        $unencryptedValue = 'foobar';
39
        openssl_sign($unencryptedValue, $encryptedValue, $this->key, OPENSSL_ALGO_SHA384);
40
        $signature = $this->algorithm->sign($unencryptedValue, $this->key);
41
42
        $this->assertSame($encryptedValue, $signature);
43
    }
44
}
45

test/Algorithm/Rs512Test.php 1 location

@@ 5-44 (lines=40) @@
2
3
namespace Emarref\Jwt\Algorithm;
4
5
class Rs512Test extends \PHPUnit_Framework_TestCase
6
{
7
    private static $name          = 'RS512';
8
    private static $algorithmName = 'sha512';
9
10
    /**
11
     * @var string
12
     */
13
    private $key;
14
15
    /**
16
     * @var Rs512
17
     */
18
    private $algorithm;
19
20
    public function setUp()
21
    {
22
        $this->key = openssl_pkey_new();
23
        $this->algorithm = new Rs512();
24
    }
25
26
    public function testGetName()
27
    {
28
        $this->assertSame(self::$name, $this->algorithm->getName());
29
    }
30
31
    public function testGetAlgorithm()
32
    {
33
        $this->assertSame(self::$algorithmName, $this->algorithm->getAlgorithm());
34
    }
35
36
    public function testCompute()
37
    {
38
        $unencryptedValue = 'foobar';
39
        openssl_sign($unencryptedValue, $encryptedValue, $this->key, OPENSSL_ALGO_SHA512);
40
        $signature = $this->algorithm->sign($unencryptedValue, $this->key);
41
42
        $this->assertSame($encryptedValue, $signature);
43
    }
44
}
45