Test Failed
Push — develop ( 7cb291...9cc0c5 )
by Reüel
03:00
created

tests/OrderStandard/ClientTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Ingenico\OrderStandard;
4
5
use Pronamic\WordPress\Pay\Gateways\Ingenico\DataGeneralHelper;
6
7
/**
8
 * Title: Ogone client class test
9
 * Description:
10
 * Copyright: 2005-2019 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.0
15
 * @since   1.1.0
16
 */
17
class ClientTest extends \WP_UnitTestCase {
0 ignored issues
show
The type WP_UnitTestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
	/**
19
	 * Test signature in empty.
20
	 */
21
	public function test_signature_in_empty() {
22
		$client = new Client( '' );
23
24
		$signature_in = $client->get_signature_in();
25
26
		$this->assertEquals( 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709', $signature_in );
27
	}
28
29
	/**
30
	 * Test signature in from documentation.
31
	 */
32
	public function test_signature_in_from_documentation() {
33
		/* @link http://pronamic.nl/wp-content/uploads/2012/02/ABNAMRO_e-Com-BAS_EN.pdf #page 11 */
34
		$client = new Client( 'MyPSPID' );
35
36
		$client->set_pass_phrase_in( 'Mysecretsig1875!?' );
37
38
		// Data.
39
		$ogone_data = $client->get_data();
40
41
		// General.
42
		$ogone_data_general = new DataGeneralHelper( $ogone_data );
43
44
		$ogone_data_general
45
			->set_amount( 1500 )
46
			->set_currency( 'EUR' )
47
			->set_language( 'en_US' )
48
			->set_order_id( '1234' );
49
50
		// Signature.
51
		$signature_in = $client->get_signature_in();
52
53
		$this->assertEquals( 'F4CC376CD7A834D997B91598FA747825A238BE0A', $signature_in );
54
	}
55
56
	/**
57
	 * Test signature out from documentation.
58
	 */
59
	public function test_signature_out_from_documentation() {
60
		/* @link http://pronamic.nl/wp-content/uploads/2012/02/ABNAMRO_e-Com-BAS_EN.pdf #page 16 */
61
		$data = array(
62
			'ACCEPTANCE' => '1234',
63
			'AMOUNT'     => '15.00',
64
			'BRAND'      => 'VISA',
65
			'CARDNO'     => 'xxxxxxxxxxxx1111',
66
			'CURRENCY'   => 'EUR',
67
			'NCERROR'    => '0',
68
			'ORDERID'    => '12',
69
			'PAYID'      => '32100123',
70
			'PM'         => 'CreditCard',
71
			'STATUS'     => '9',
72
			'SHASIGN'    => '8DC2A769700CA4B3DF87FE8E3B6FD162D6F6A5FA',
73
		);
74
75
		$client = new Client( 'MyPSPID' );
76
77
		$client->set_pass_phrase_out( 'Mysecretsig1875!?' );
78
79
		$result = $client->verify_request( $data );
80
81
		$this->assertNotSame( false, $result );
82
	}
83
}
84