1 | <?php |
||
2 | |||
3 | namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay; |
||
4 | |||
5 | use WP_UnitTestCase; |
||
6 | |||
7 | class RedirectTransactionParserTest extends WP_UnitTestCase { |
||
8 | /** |
||
9 | * Test init |
||
10 | */ |
||
11 | public function test_init() { |
||
12 | $filename = dirname( dirname( __FILE__ ) ) . '/Mock/redirect-transaction-response.xml'; |
||
13 | |||
14 | $simplexml = simplexml_load_file( $filename ); |
||
15 | |||
16 | $this->assertInstanceOf( 'SimpleXMLElement', $simplexml ); |
||
17 | |||
18 | return $simplexml; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * Test parser |
||
23 | * |
||
24 | * @depends test_init |
||
25 | */ |
||
26 | public function test_parser( $simplexml ) { |
||
27 | $message = XML\RedirectTransactionResponseMessage::parse( $simplexml ); |
||
28 | |||
29 | $this->assertInstanceOf( __NAMESPACE__ . '\XML\RedirectTransactionResponseMessage', $message ); |
||
30 | |||
31 | return $message; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Test values |
||
36 | * |
||
37 | * @depends test_parser |
||
38 | */ |
||
39 | public function test_values( $message ) { |
||
40 | $expected = new XML\RedirectTransactionResponseMessage(); |
||
41 | |||
42 | $expected->result = 'ok'; |
||
43 | |||
44 | $transaction = new Transaction(); |
||
45 | |||
46 | $transaction->id = 'ABCD1234'; |
||
47 | $transaction->payment_url = 'http://www.multisafepay.com/pay/...&lang=en'; |
||
48 | |||
49 | $expected->transaction = $transaction; |
||
0 ignored issues
–
show
|
|||
50 | |||
51 | $this->assertEquals( $expected, $message ); |
||
52 | } |
||
53 | } |
||
54 |
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..