Failed Conditions
Push — develop ( 84789b...288de2 )
by Reüel
06:59
created

tests/src/DirectTransactionParserTest.php (1 issue)

1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay;
4
5
use WP_UnitTestCase;
6
7
class DirectTransactionParserTest extends WP_UnitTestCase {
8
	public function test_init() {
9
		$filename = dirname( dirname( __FILE__ ) ) . '/Mock/direct-transaction-response.xml';
10
11
		$simplexml = simplexml_load_file( $filename );
12
13
		$this->assertInstanceOf( '\SimpleXMLElement', $simplexml );
14
15
		return $simplexml;
16
	}
17
18
	/**
19
	 * Test parser
20
	 *
21
	 * @depends test_init
22
	 */
23
	public function test_parser( $simplexml ) {
24
		$message = XML\DirectTransactionResponseMessage::parse( $simplexml );
25
26
		$this->assertInstanceOf( __NAMESPACE__ . '\XML\DirectTransactionResponseMessage', $message );
27
28
		return $message;
29
	}
30
31
	/**
32
	 * Test values
33
	 *
34
	 * @depends test_parser
35
	 */
36
	public function test_values( $message ) {
37
		$expected = new XML\DirectTransactionResponseMessage();
38
39
		$expected->result = 'ok';
40
41
		$expected->transaction = new Transaction();
0 ignored issues
show
Documentation Bug introduced by
It seems like new Pronamic\WordPress\P...tiSafepay\Transaction() of type Pronamic\WordPress\Pay\G...ultiSafepay\Transaction is incompatible with the declared type Pronamic\WordPress\Pay\G...nsactionResponseMessage of property $transaction.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
42
43
		$expected->transaction->id = '554202bb33498';
44
45
		$expected->gateway_info = new GatewayInfo();
46
47
		$expected->gateway_info->redirect_url = 'http://testpay.multisafepay.com/simulator/ideal?trxid=10447735643871196&ideal=prob&issuerid=3151&merchantReturnURL=https%3A%2F%2Ftestpay%2Emultisafepay%2Ecom%2Fdirect%2Fcomplete%2F%3Fid%3D9943038943576689';
48
		$expected->gateway_info->ext_var      = 'https://testpay.multisafepay.com/direct/complete/';
49
		$expected->gateway_info->issuer_id    = '3151';
50
51
		$this->assertEquals( $expected, $message );
52
	}
53
}
54