Issues (9)

tests/src/PaymentRequestTest.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * Payment Request Test
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2022 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\Payvision
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Payvision;
12
13
/**
14
 * Payment Request Test
15
 *
16
 * @author  Remco Tolsma
17
 * @version 1.1.0
18
 * @since   1.0.0
19
 */
20
class PaymentRequestTest extends \WP_UnitTestCase {
21
	/**
22
	 * Test.
23
	 */
24
	public function test() {
25
		$header = new RequestHeader( '123456' );
26
27
		$transaction = new Transaction( '1', 50, 'EUR', '12345678' );
0 ignored issues
show
'12345678' of type string is incompatible with the type Pronamic\WordPress\Pay\G...\Payvision\TrackingCode expected by parameter $tracking_code of Pronamic\WordPress\Pay\G...nsaction::__construct(). ( Ignorable by Annotation )

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

27
		$transaction = new Transaction( '1', 50, 'EUR', /** @scrutinizer ignore-type */ '12345678' );
Loading history...
28
29
		$payment_request = new PaymentRequest( $header, $transaction );
30
31
		$bank = new BankDetails();
32
		$bank->set_issuer_id( IssuerIdIDeal::ABN_AMRO );
33
34
		$payment_request->set_bank( $bank );
35
36
		$this->assertInstanceOf( PaymentRequest::class, $payment_request );
37
38
		// JSON.
39
		$json_file = __DIR__ . '/../json/payment-request.json';
40
41
		$json_string = \wp_json_encode( $payment_request, \JSON_PRETTY_PRINT );
42
43
		$this->assertJsonStringEqualsJsonFile( $json_file, $json_string );
0 ignored issues
show
It seems like $json_string can also be of type false; however, parameter $actualJson of PHPUnit\Framework\Assert...nStringEqualsJsonFile() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

43
		$this->assertJsonStringEqualsJsonFile( $json_file, /** @scrutinizer ignore-type */ $json_string );
Loading history...
44
	}
45
}
46