Failed Conditions
Push — develop ( bda8a4...041628 )
by Reüel
02:55
created

DataCreditCardHelperTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_helper() 0 17 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Ingenico;
4
5
use DateTime;
6
7
/**
8
 * Title: Ogone data default helper 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 DataCreditCardHelperTest extends \WP_UnitTestCase {
18
	/**
19
	 * Test helper
20
	 */
21
	function test_helper() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
22
		$data = new Data();
23
24
		$helper = new DataCreditCardHelper( $data );
25
26
		$ed = new DateTime();
27
28
		$helper
29
			->set_number( '378282246310005' )
0 ignored issues
show
Bug introduced by
'378282246310005' of type string is incompatible with the type integer expected by parameter $number of Pronamic\WordPress\Pay\G...ardHelper::set_number(). ( Ignorable by Annotation )

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

29
			->set_number( /** @scrutinizer ignore-type */ '378282246310005' )
Loading history...
30
			->set_expiration_date( $ed )
31
			->set_security_code( '123' );
32
33
		$this->assertEquals( array(
34
			'CARDNO' => '378282246310005',
35
			'ED'     => $ed->format( Ingenico::EXPIRATION_DATE_FORMAT ),
36
			'CVC'    => '123',
37
		), $data->get_fields() );
38
	}
39
}
40