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 ( ddb0ea...11b6fd )
by Jelte
02:26
created

LegacyShaComposerTest::defaultParameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Marlon Ogone package.
5
 *
6
 * (c) Marlon BVBA <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ogone\Tests\ShaComposer;
13
14
use Ogone\HashAlgorithm;
15
use Ogone\Passphrase;
16
use Ogone\PaymentResponse;
17
use Ogone\ShaComposer\LegacyShaComposer;
18
19
class LegacyShaComposerTest extends \PHPUnit_Framework_TestCase
20
{
21
    const PASSPHRASE = 'passphrase-set-in-ogone-interface';
22
    const SHA1STRING = '66BF34D8B3EF2136E0C267BDBC1F708B8D75A8AA';
23
    const SHA256STRING = '882D85FCCC6112A33D3B8A571C11723CAA6B642EED70843B35B15ABA0C2AD637';
24
    const SHA512STRING = '8552200DD108CB5633A27D6D0A1FAB54378CB2385BFCEB27487992D16F5A7565E5DD4D38C0F2DB294213CD02E434F311021749E6DAB187357F786E3F199781CA';
25
26
    /** @test */
27 View Code Duplication
    public function defaultParameters()
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...
28
    {
29
        $aRequest = $this->provideRequest();
30
        $composer = new LegacyShaComposer(new Passphrase(self::PASSPHRASE));
0 ignored issues
show
Deprecated Code introduced by
The class Ogone\ShaComposer\LegacyShaComposer has been deprecated with message: Use AllParametersShaComposer wherever possible

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
31
        $shaString = $composer->compose($aRequest);
32
        $this->assertEquals(self::SHA1STRING, $shaString);
33
    }
34
35
    /** @test */
36 View Code Duplication
    public function Sha1StringCanBeComposed()
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...
37
    {
38
        $aRequest = $this->provideRequest();
39
40
        $composer = new LegacyShaComposer(new Passphrase(self::PASSPHRASE), new HashAlgorithm(HashAlgorithm::HASH_SHA1));
0 ignored issues
show
Deprecated Code introduced by
The class Ogone\ShaComposer\LegacyShaComposer has been deprecated with message: Use AllParametersShaComposer wherever possible

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
41
        $shaString = $composer->compose($aRequest);
42
43
        $this->assertEquals(self::SHA1STRING, $shaString);
44
    }
45
46
    /** @test */
47 View Code Duplication
    public function Sha256StringCanBeComposed()
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...
48
    {
49
        $aRequest = $this->provideRequest();
50
51
        $composer = new LegacyShaComposer(new Passphrase(self::PASSPHRASE), new HashAlgorithm(HashAlgorithm::HASH_SHA256));
0 ignored issues
show
Deprecated Code introduced by
The class Ogone\ShaComposer\LegacyShaComposer has been deprecated with message: Use AllParametersShaComposer wherever possible

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
52
        $shaString = $composer->compose($aRequest);
53
54
        $this->assertEquals(self::SHA256STRING, $shaString);
55
    }
56
57
    /** @test */
58 View Code Duplication
    public function Sha512StringCanBeComposed()
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...
59
    {
60
        $aRequest = $this->provideRequest();
61
62
        $composer = new LegacyShaComposer(new Passphrase(self::PASSPHRASE), new HashAlgorithm(HashAlgorithm::HASH_SHA512));
0 ignored issues
show
Deprecated Code introduced by
The class Ogone\ShaComposer\LegacyShaComposer has been deprecated with message: Use AllParametersShaComposer wherever possible

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
63
        $shaString = $composer->compose($aRequest);
64
65
        $this->assertEquals(self::SHA512STRING, $shaString);
66
    }
67
68
    private function provideRequest()
69
    {
70
        return array(
71
            'ACCEPTANCE' => 'test123',
72
            'AMOUNT' => '19.08',
73
            'BRAND' => 'VISA',
74
            'CARDNO' => 'XXXXXXXXXXXX1111',
75
            'CN' => 'Marlon',
76
            'CURRENCY' => 'EUR',
77
            'ED' => '0113',
78
            'IP' => '81.82.214.142',
79
            'NCERROR' => 0,
80
            'ORDERID' => 2101947639,
81
            'PAYID' => 10673859,
82
            'PM' => 'CreditCard',
83
            'STATUS' => PaymentResponse::STATUS_AUTHORISED,
84
            'TRXDATE' => '07/05/11'
85
        );
86
    }
87
}
88