testcase-xmlrpc.php 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. require_once ABSPATH . 'wp-admin/includes/admin.php';
  3. require_once ABSPATH . WPINC . '/class-IXR.php';
  4. require_once ABSPATH . WPINC . '/class-wp-xmlrpc-server.php';
  5. class WP_XMLRPC_UnitTestCase extends WP_UnitTestCase {
  6. protected $myxmlrpcserver;
  7. function setUp() {
  8. parent::setUp();
  9. add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
  10. $this->myxmlrpcserver = new wp_xmlrpc_server();
  11. }
  12. function tearDown() {
  13. remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
  14. $this->remove_added_uploads();
  15. parent::tearDown();
  16. }
  17. protected static function make_user_by_role( $role ) {
  18. return self::factory()->user->create(
  19. array(
  20. 'user_login' => $role,
  21. 'user_pass' => $role,
  22. 'role' => $role,
  23. )
  24. );
  25. }
  26. }