Test Failed
Push — develop ( 19a0d9...9b1653 )
by Reüel
03:31
created

tests/src/ClientTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\PayNL;
4
5
use WP_UnitTestCase;
6
use WP_Http;
7
8
/**
9
 * Title: Pay.nl client test
10
 * Description:
11
 * Copyright: 2005-2019 Pronamic
12
 * Company: Pronamic
13
 *
14
 * @author  Remco Tolsma
15
 * @version 2.0.0
16
 * @since   1.0.0
17
 */
18
class ClientTest extends \WP_UnitTestCase {
19
	/**
20
	 * Pre HTTP request
21
	 *
22
	 * @link https://github.com/WordPress/WordPress/blob/3.9.1/wp-includes/class-http.php#L150-L164
23
	 * @return string
24
	 */
25
	public function pre_http_request( $preempt, $request, $url ) {
26
		$response = file_get_contents( dirname( dirname( __FILE__ ) ) . '/Mock/transaction-get-service-json-ideal-service-not-found.http', true );
27
28
		$processed_response = WP_Http::processResponse( $response );
29
30
		$processed_headers = WP_Http::processHeaders( $processed_response['headers'], $url );
31
32
		$processed_headers['body'] = $processed_response['body'];
33
34
		return $processed_headers;
35
	}
36
37
	public function test_get_issuers() {
38
		add_filter( 'pre_http_request', array( $this, 'pre_http_request' ), 10, 3 );
39
40
		$client = new Client( '', '' );
41
42
		$issuers = $client->get_issuers();
43
44
		$this->assertFalse( $issuers );
45
		$this->assertInstanceOf( 'WP_Error', $client->get_error() );
0 ignored issues
show
The method get_error() does not exist on Pronamic\WordPress\Pay\Gateways\PayNL\Client. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
		$this->assertInstanceOf( 'WP_Error', $client->/** @scrutinizer ignore-call */ get_error() );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
	}
47
}
48