forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcase-xmlrpc.php
More file actions
38 lines (29 loc) · 826 Bytes
/
testcase-xmlrpc.php
File metadata and controls
38 lines (29 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once ABSPATH . 'wp-admin/includes/admin.php';
require_once ABSPATH . WPINC . '/class-IXR.php';
require_once ABSPATH . WPINC . '/class-wp-xmlrpc-server.php';
abstract class WP_XMLRPC_UnitTestCase extends WP_UnitTestCase {
/**
* @var wp_xmlrpc_server
*/
protected $myxmlrpcserver;
public function set_up() {
parent::set_up();
add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
$this->myxmlrpcserver = new wp_xmlrpc_server();
}
public function tear_down() {
remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
$this->remove_added_uploads();
parent::tear_down();
}
protected static function make_user_by_role( $role ) {
return self::factory()->user->create(
array(
'user_login' => $role,
'user_pass' => $role,
'role' => $role,
)
);
}
}