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
Pull Request — master (#82)
by
unknown
03:34
created

FlexCheckoutPaymentResponseTest::testResponse()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
cc 1
eloc 20
nc 1
nop 0
1
<?php namespace Ogone\Tests\FlexCheckout;
2
3
use GuzzleHttp\Client;
4
use Ogone\FlexCheckout\FlexCheckoutPaymentRequest;
5
use Ogone\FlexCheckout\Alias;
6
7
use Ogone\FlexCheckout\FlexCheckoutPaymentResponse;
8
use Ogone\HashAlgorithm;
9
use Ogone\Passphrase;
10
use Ogone\ShaComposer\AllParametersShaComposer;
11
use Ogone\ShaComposer\ShaComposer;
12
use TestCase;
13
14
class FlexCheckoutPaymentResponseTest extends TestCase
15
{
16
	private $configuration;
17
18
	public function testResponse()
19
	{
20
		$parameters = [
21
			"Alias_AliasId"       => "4",
22
			"Card_Bin"            => "411111",
23
			"Card_Brand"          => "VISA",
24
			"Card_CardNumber"     => "XXXXXXXXXXXX1111",
25
			"Card_CardHolderName" => "Holder Test",
26
			"Card_Cvc"            => "XXX",
27
			"Card_ExpiryDate"     => "0319",
28
			"Alias_NCError"       => "0",
29
			"Alias_NCErrorCardNo" => "0",
30
			"Alias_NCErrorCN"     => "0",
31
			"Alias_NCErrorCVC"    => "0",
32
			"Alias_NCErrorED"     => "0",
33
			"Alias_OrderId"       => "4422",
34
			"Alias_Status"        => "2",
35
			"SHASign"             => "BD9F63BC7FA689E690957DDA1C6E8BDD4A5F1A5F",
36
		];
37
38
		$sha  = new FakeShaComposer;
39
		$flex = new FlexCheckoutPaymentResponse($parameters);
40
		$flex->isValid($sha);
41
	}
42
43
	/**
44
	 * @return AllParametersShaComposer
45
	 */
46
	protected function getShaComposer()
47
	{
48
		$ogone_config = config("ogone");
49
50
		$this->configuration = [
51
			'sha_in'          => $ogone_config["sha_in"],
52
			'sha_out'         => $ogone_config["sha_out"],
53
			'psp_id'          => $ogone_config["psp_id"],
54
			'user_id'         => $ogone_config["user_id"],
55
			'password'        => $ogone_config["password"],
56
			'url_payment'     => $ogone_config["url_payment"],
57
			'url_maintenance' => $ogone_config["url_maintenance"],
58
		];
59
60
		$passphrase    = new Passphrase($this->configuration['sha_out']);
61
		$hash_algoritm = new HashAlgorithm(HashAlgorithm::HASH_SHA1);
62
		$shaComposer   = new AllParametersShaComposer($passphrase, $hash_algoritm);
63
		return $shaComposer;
64
	}
65
}
66
67
class FakeShaComposer implements ShaComposer
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Ogone\Tests\FlexCheckout\FakeShaComposer has been defined more than once; this definition is ignored, only the first definition in tests/Ogone/Tests/FlexCh...tPaymentRequestTest.php (L41-49) is considered.

This check looks for classes that have been defined more than once.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
68
{
69
	const FAKESHASTRING = 'foo';
70
71
	public function compose(array $responseParameters)
72
	{
73
		return self::FAKESHASTRING;
74
	}
75
}
76
77