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
|
|
|
|