Failed Conditions
Push — develop ( 6c29e1...37d097 )
by Reüel
03:10
created

DataCreditCardHelperTest::test_helper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 17
rs 9.8666
c 0
b 0
f 0
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