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.

CreateAliasResponseTest::provideRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of the Marlon Ogone package.
4
 *
5
 * (c) Marlon BVBA <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Ogone\Tests\DirectLink;
12
13
use Ogone\DirectLink\CreateAliasResponse;
14
use Ogone\Tests\ShaComposer\FakeShaComposer;
15
16
class CreateAliasResponseTest extends \PHPUnit_Framework_TestCase
17
{
18
19
    /** @test */
20
    public function CanBeVerified()
21
    {
22
        $aRequest = $this->provideRequest();
23
24
        $createAliasResponse = new CreateAliasResponse($aRequest);
25
        $this->assertTrue($createAliasResponse->isValid(new FakeShaComposer));
26
    }
27
28
    /**
29
     * @test
30
     * @expectedException InvalidArgumentException
31
     */
32
    public function CannotExistWithoutShaSign()
33
    {
34
        $createAliasResponse = new CreateAliasResponse(array());
0 ignored issues
show
Unused Code introduced by
$createAliasResponse is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
35
    }
36
37
    /** @test */
38 View Code Duplication
    public function ParametersCanBeRetrieved()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        $aRequest = $this->provideRequest();
41
42
        $createAliasResponse = new CreateAliasResponse($aRequest);
43
        $this->assertEquals($aRequest['orderID'], $createAliasResponse->getParam('orderid'));
44
    }
45
46
    /** @test */
47
    public function ChecksStatus()
48
    {
49
        $aRequest = $this->provideRequest();
50
51
        $createAliasResponse = new CreateAliasResponse($aRequest);
52
        $this->assertTrue($createAliasResponse->isSuccessful());
53
    }
54
55
    /** @test */
56
    public function AliasIsEqual()
57
    {
58
        $aRequest = $this->provideRequest();
59
        $createAliasResponse = new CreateAliasResponse($aRequest);
60
        $alias = $createAliasResponse->getAlias();
61
        $this->assertEquals('customer_123', $alias->__toString());
62
        $this->assertEquals($aRequest['CN'], $alias->getCardName());
63
        $this->assertEquals($aRequest['CARDNO'], $alias->getCardNumber());
64
        $this->assertEquals($aRequest['ED'], $alias->getExpiryDate());
65
    }
66
67
    /**
68
     * Helper method to setup a request array
69
     */
70
    private function provideRequest()
71
    {
72
        return array(
73
            'SHASIGN' => FakeShaComposer::FAKESHASTRING,
74
            'UNKNOWN_PARAM' => false, /* unkown parameter, should be filtered out */
75
            'status' => 0,
76
            'orderID' => '48495482424',
77
            'alias' => 'customer_123',
78
            'CN' => 'John Doe',
79
            'CARDNO' => 'xxxxxxxxxxx4848',
80
            'ED' => '1220'
81
        );
82
    }
83
}
84