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.
Completed
Push — master ( 895536...6d2180 )
by Joni
01:43
created

PEMTest::testFromFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
use Sop\CryptoEncoding\PEM;
3
4
/**
5
 * @group pem
6
 */
7
class PEMTest extends PHPUnit_Framework_TestCase
8
{
9
    /**
10
     */
11
    public function testFromString()
12
    {
13
        $str = file_get_contents(TEST_ASSETS_DIR . "/public_key.pem");
14
        $pem = PEM::fromString($str);
15
        $this->assertInstanceOf(PEM::class, $pem);
16
    }
17
    
18
    /**
19
     *
20
     * @return \Sop\CryptoEncoding\PEM
21
     */
22
    public function testFromFile()
23
    {
24
        $pem = PEM::fromFile(TEST_ASSETS_DIR . "/public_key.pem");
25
        $this->assertInstanceOf(PEM::class, $pem);
26
        return $pem;
27
    }
28
    
29
    /**
30
     * @depends testFromFile
31
     *
32
     * @param PEM $pem
33
     */
34
    public function testType(PEM $pem)
35
    {
36
        $this->assertEquals(PEM::TYPE_PUBLIC_KEY, $pem->type());
37
    }
38
    
39
    /**
40
     */
41
    public function testData()
42
    {
43
        $data = "payload";
44
        $encoded = base64_encode($data);
45
        $str = <<<DATA
46
-----BEGIN TEST-----
47
$encoded
48
-----END TEST-----
49
DATA;
50
        $this->assertEquals($data, PEM::fromString($str)->data());
51
    }
52
    
53
    /**
54
     * @expectedException UnexpectedValueException
55
     */
56
    public function testInvalidPEM()
57
    {
58
        PEM::fromString("invalid");
59
    }
60
    
61
    /**
62
     * @expectedException UnexpectedValueException
63
     */
64
    public function testInvalidPEMData()
65
    {
66
        $str = <<<DATA
67
-----BEGIN TEST-----
68
%%%
69
-----END TEST-----
70
DATA;
71
        PEM::fromString($str);
72
    }
73
    
74
    /**
75
     * @expectedException RuntimeException
76
     */
77
    public function testInvalidFile()
78
    {
79
        PEM::fromFile(TEST_ASSETS_DIR . "/nonexistent");
80
    }
81
    
82
    /**
83
     * @depends testFromFile
84
     *
85
     * @param PEM $pem
86
     */
87
    public function testString(PEM $pem)
88
    {
89
        $this->assertInternalType("string", $pem->string());
90
    }
91
    
92
    /**
93
     * @depends testFromFile
94
     *
95
     * @param PEM $pem
96
     */
97
    public function testToString(PEM $pem)
98
    {
99
        $this->assertInternalType("string", strval($pem));
100
    }
101
}
102