Completed
Push — update/base-styles-210 ( 2e278b...ad767b )
by Jeremy
22:25 queued 13:15
created

XMLRPC_Async_Call_Test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_add_call() 0 16 2
1
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase
2
/**
3
 * Connection Manager functionality testing.
4
 *
5
 * @package automattic/jetpack-connection
6
 */
7
8
namespace Automattic\Jetpack\Connection;
9
10
use WorDBless\BaseTestCase;
11
12
require_once ABSPATH . WPINC . '/IXR/class-IXR-client.php';
13
/**
14
 * Connection Manager functionality testing.
15
 */
16
class XMLRPC_Async_Call_Test extends BaseTestCase {
17
18
	/**
19
	 * Test add call
20
	 */
21
	public function test_add_call() {
22
		XMLRPC_Async_Call::add_call( 'test', 0, 'test_arg', 'test_arg2' );
23
		XMLRPC_Async_Call::add_call( 'test', 1, 'test_arg', 'test_arg2' );
24
25
		$client_blog_id = is_multisite() ? get_current_blog_id() : 0;
26
27
		$this->assertArrayHasKey( $client_blog_id, XMLRPC_Async_Call::$clients );
28
		$this->assertInstanceOf( 'Jetpack_IXR_ClientMulticall', XMLRPC_Async_Call::$clients[ $client_blog_id ][0] );
29
		$this->assertInstanceOf( 'Jetpack_IXR_ClientMulticall', XMLRPC_Async_Call::$clients[ $client_blog_id ][1] );
30
31
		$this->assertNotEmpty( XMLRPC_Async_Call::$clients[ $client_blog_id ][0]->calls );
32
		$this->assertEquals( 'test', XMLRPC_Async_Call::$clients[ $client_blog_id ][0]->calls[0]['methodName'] );
33
		$this->assertEquals( array( 'test_arg', 'test_arg2' ), XMLRPC_Async_Call::$clients[ $client_blog_id ][0]->calls[0]['params'] );
34
35
		$this->assertEquals( 10, has_action( 'shutdown', array( 'Automattic\Jetpack\Connection\XMLRPC_Async_Call', 'do_calls' ) ) );
36
	}
37
38
}
39