HashCodingTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_hashcoding() 0 32 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\IDealBasic;
4
5
use DateTime;
6
use Pronamic\WordPress\Money\Money;
7
8
class HashCodingTest extends \WP_UnitTestCase {
9
	/**
10
	 * Test hash coding.
11
	 */
12
	public function test_hashcoding() {
13
		/* @link http://pronamic.nl/wp-content/uploads/2011/12/IDealBasic_EN_v2.3.pdf #page 23 */
14
		$client = new Client();
15
16
		$client->set_hash_key( '41e3hHbYhmxxxxxx' );
17
		$client->set_merchant_id( '0050xxxxx' );
18
		$client->set_sub_id( '0' );
19
		$client->set_purchase_id( '10' );
20
		$client->set_payment_type( 'ideal' );
21
		$client->set_expire_date( new DateTime( '2009-01-01 12:34:56' ) );
22
23
		$item = new Item( '1', 'omschrijving', 1, new Money( 1 ) );
24
25
		$items = $client->get_items();
26
		$items->add_item( $item );
27
28
		// Other variables (not in hash).
29
		$client->set_language( 'nl' );
30
		$client->set_currency( 'EUR' );
31
		$client->set_description( 'Example hashcode' );
32
33
		$baseurl = 'http://www.uwwebwinkel.nl';
34
35
		$client->set_success_url( "$baseurl/Success.html" );
36
		$client->set_cancel_url( "$baseurl/Cancel.html" );
37
		$client->set_error_url( "$baseurl/Error.html" );
38
39
		// Create hash.
40
		$shasign = $client->create_hash();
41
42
		// Assert.
43
		$this->assertEquals( '7615604527e1edd65521e2180e445d3a89abc794', $shasign );
44
	}
45
}
46