DataGeneralHelperTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 34
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_helper() 0 41 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Ingenico;
4
5
/**
6
 * Title: Ogone data default helper class test
7
 * Description:
8
 * Copyright: 2005-2021 Pronamic
9
 * Company: Pronamic
10
 *
11
 * @author  Remco Tolsma
12
 * @version 2.0.0
13
 * @since   1.1.0
14
 */
15
class DataGeneralHelperTest extends \WP_UnitTestCase {
16
	/**
17
	 * Test helper
18
	 */
19
	public function test_helper() {
20
		$data = new Data();
21
22
		$helper = new DataGeneralHelper( $data );
23
24
		$pmlist = new PaymentMethodsList(
25
			array(
26
				Brands::VISA,
27
				Brands::MASTERCARD,
28
				Brands::AMERICAN_EXPRESS,
29
			)
30
		);
31
32
		$helper
0 ignored issues
show
Deprecated Code introduced by
The function Pronamic\WordPress\Pay\G...eralHelper::set_email() has been deprecated: since 1.3.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

32
		/** @scrutinizer ignore-deprecated */ $helper

This function has been deprecated. The supplier of the function has supplied an explanatory message.

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

Loading history...
Deprecated Code introduced by
The function Pronamic\WordPress\Pay\G...er::set_customer_name() has been deprecated: since 1.3.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

32
		/** @scrutinizer ignore-deprecated */ $helper

This function has been deprecated. The supplier of the function has supplied an explanatory message.

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

Loading history...
33
			->set_psp_id( 'test' )
0 ignored issues
show
Bug introduced by
'test' of type string is incompatible with the type integer expected by parameter $number of Pronamic\WordPress\Pay\G...ralHelper::set_psp_id(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

33
			->set_psp_id( /** @scrutinizer ignore-type */ 'test' )
Loading history...
34
			->set_order_id( '1234' )
35
			->set_order_description( 'order description' )
36
			->set_amount( '1050' )
37
			->set_currency( 'EUR' )
38
			->set_customer_name( 'Mr. Test' )
39
			->set_email( '[email protected]' )
40
			->set_language( 'nl' )
41
			->set_payment_method( PaymentMethods::IDEAL )
42
			->set_payment_methods_list( $pmlist )
43
			->set_brand( Brands::IDEAL );
44
45
		$this->assertEquals(
46
			array(
47
				'PSPID'    => 'test',
48
				'ORDERID'  => '1234',
49
				'COM'      => 'order description',
50
				'AMOUNT'   => '1050',
51
				'CURRENCY' => 'EUR',
52
				'CN'       => 'Mr. Test',
53
				'EMAIL'    => '[email protected]',
54
				'LANGUAGE' => 'nl',
55
				'PM'       => PaymentMethods::IDEAL,
56
				'PMLIST'   => (string) $pmlist,
57
				'BRAND'    => Brands::IDEAL,
58
			),
59
			$data->get_fields()
60
		);
61
	}
62
}
63