Failed Conditions
Push — develop ( 0669ed...0eccc5 )
by Reüel
05:00
created

RedirectTransactionParserTest::test_values()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
rs 10
cc 1
nc 1
nop 1
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
Documentation Bug introduced by
It seems like $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...
50
51
		$this->assertEquals( $expected, $message );
52
	}
53
}
54