wordpress-develop/tests/phpunit/includes/testcase-xmlrpc.php
Sergey Biryukov 385025b0ba Build/Test Tools: Declare two TestCase classes as abstract.
TestCases which are intended to be extended and not run directly, should be `abstract`.

Follow-up to [763/tests], [30277].

Props jrf.
See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51585 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-09 14:51:05 +00:00

36 lines
776 B
PHP

<?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 {
protected $myxmlrpcserver;
function set_up() {
parent::set_up();
add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
$this->myxmlrpcserver = new wp_xmlrpc_server();
}
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,
)
);
}
}