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.

IsValidWhenRequiredFieldsAreFilledIn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * @author Nicolas Clavaud <[email protected]>
4
 */
5
6
namespace Ogone\Tests\DirectLink;
7
8
use Ogone\Tests\ShaComposer\FakeShaComposer;
9
use Ogone\DirectLink\DirectLinkQueryRequest;
10
11
class DirectLinkQueryRequestTest extends \PHPUnit_Framework_TestCase
12
{
13
14
    /** @test */
15
    public function IsValidWhenRequiredFieldsAreFilledIn()
16
    {
17
        $directLinkQueryRequest = $this->provideMinimalDirectLinkQueryRequest();
18
        $directLinkQueryRequest->validate();
19
    }
20
21
    /**
22
     * @test
23
     * @expectedException \RuntimeException
24
     */
25
    public function IsInvalidWhenFieldsAreMissing()
26
    {
27
        $directLinkQueryRequest = new DirectLinkQueryRequest(new FakeShaComposer);
28
        $directLinkQueryRequest->validate();
29
    }
30
31
    /**
32
     * @test
33
     * @expectedException \InvalidArgumentException
34
     */
35
    public function isInvalidWithNonOgoneUrl()
36
    {
37
        $directLinkQueryRequest = $this->provideMinimalDirectLinkQueryRequest();
38
        $directLinkQueryRequest->setOgoneUri('http://example.com');
39
        $directLinkQueryRequest->validate();
40
    }
41
42
    /**
43
     * @test
44
     */
45
    public function isValidWithOgoneUrl()
46
    {
47
        $directLinkQueryRequest = $this->provideMinimalDirectLinkQueryRequest();
48
        $directLinkQueryRequest->setOgoneUri(DirectLinkQueryRequest::PRODUCTION);
49
        $directLinkQueryRequest->validate();
50
    }
51
52
    /**
53
     * @test
54
     * @dataProvider provideBadParameters
55
     * @expectedException \InvalidArgumentException
56
     */
57
    public function BadParametersCauseExceptions($method, $value)
58
    {
59
        $directLinkQueryRequest = new DirectLinkQueryRequest(new FakeShaComposer);
60
        $directLinkQueryRequest->$method($value);
61
    }
62
63
    public function provideBadParameters()
64
    {
65
        return array(
66
            array('setPassword', '12'),
67
            array('setUserid', '1'),
68
        );
69
    }
70
71
    /** @return DirectLinkQueryRequest */
72
    private function provideMinimalDirectLinkQueryRequest()
73
    {
74
        $directLinkRequest = new DirectLinkQueryRequest(new FakeShaComposer());
75
        $directLinkRequest->setPspid('123456');
76
        $directLinkRequest->setUserId('user_1234');
77
        $directLinkRequest->setPassword('abracadabra');
78
        $directLinkRequest->setPayId('12345678');
79
80
        return $directLinkRequest;
81
    }
82
}
83