Failed Conditions
Push — master ( f5ff3b...44b23a )
by Remco
147:23 queued 138:46
created

ErrorParserTest::testParser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 15
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\XML;
4
5
use PHPUnit_Framework_TestCase;
6
7
/**
8
 * Title: iDEAL Advanced v3 XML error parser test
9
 * Description:
10
 * Copyright: 2005-2019 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author Remco Tolsma
14
 * @version 1.0.0
15
 */
16
class ErrorParserTest extends PHPUnit_Framework_TestCase {
17
	public function testParser() {
18
		$parser = new ErrorParser();
19
20
		$xml = simplexml_load_file( dirname( dirname( dirname( __FILE__ ) ) ) . '/Mock/Error.xml' );
21
22
		$error = $parser->parse( $xml );
23
24
		$string = (string) $error;
0 ignored issues
show
Unused Code introduced by
The assignment to $string is dead and can be removed.
Loading history...
25
26
		$this->assertInstanceOf( '\Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Error', $error );
27
		$this->assertSame( 'SO1100', $error->get_code() );
28
		$this->assertSame( 'Issuer not available', $error->get_message() );
29
		$this->assertSame( 'System generating error: Rabobank', $error->get_detail() );
30
		$this->assertSame( null, $error->get_suggested_action() );
31
		$this->assertSame( 'De geselecteerde iDEAL bank is momenteel niet beschikbaar i.v.m. onderhoud tot naar verwachting 31-12-2010 03:30. Probeer het later nogmaals of betaal op een andere manier.', $error->get_consumer_message() );
32
	}
33
}
34