ErrorParserTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 21
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testParser() 0 15 1
1
<?php
2
/**
3
 * Error parser test.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2021 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\XML;
12
13
use PHPUnit_Framework_TestCase;
14
15
/**
16
 * Title: iDEAL Advanced v3 XML error parser test
17
 * Description:
18
 * Copyright: 2005-2021 Pronamic
19
 * Company: Pronamic
20
 *
21
 * @author Remco Tolsma
22
 * @version 1.0.0
23
 */
24
class ErrorParserTest extends PHPUnit_Framework_TestCase {
25
	/**
26
	 * Test parser.
27
	 *
28
	 * @return void
29
	 */
30
	public function testParser() {
31
		$parser = new ErrorParser();
32
33
		$xml = simplexml_load_file( dirname( dirname( dirname( __FILE__ ) ) ) . '/Mock/Error.xml' );
34
35
		$error = $parser->parse( $xml );
36
37
		$string = (string) $error;
0 ignored issues
show
Unused Code introduced by
The assignment to $string is dead and can be removed.
Loading history...
38
39
		$this->assertInstanceOf( '\Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Error', $error );
40
		$this->assertSame( 'SO1100', $error->get_code() );
41
		$this->assertSame( 'Issuer not available', $error->get_message() );
42
		$this->assertSame( 'System generating error: Rabobank', $error->get_detail() );
43
		$this->assertSame( null, $error->get_suggested_action() );
44
		$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() );
45
	}
46
}
47