WordPress.org

Make WordPress Core

Changeset 1025 in tests


Ignore:
Timestamp:
09/19/2012 01:21:58 AM (6 years ago)
Author:
nacin
Message:

Add a test for XML-RPC's deprecated login_pass_ok method. Rename enabled.php to basic.php - generic enough that it shouldn't change again.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/tests/xmlrpc/basic.php

    r1015 r1025  
    88 * @group xmlrpc
    99 */
    10 class Tests_XMLRPC_Enabled extends WP_UnitTestCase {
     10class Tests_XMLRPC_Basic extends WP_XMLRPC_UnitTestCase {
    1111    function test_enabled() {
    12         $myxmlrpcserver = new wp_xmlrpc_server();
    13         $result = $myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
     12        $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
    1413
    1514        $this->assertInstanceOf( 'IXR_Error', $result );
     
    1716        $this->assertEquals( 403, $result->code );
    1817    }
     18
     19    function test_login_pass_ok() {
     20        $user_id = $this->make_user_by_role( 'subscriber' );
     21
     22        $this->assertFalse( $this->myxmlrpcserver->login_pass_ok( 'username', 'password' ) );
     23        $this->assertFalse( $this->myxmlrpcserver->login( 'username', 'password' ) );
     24
     25        $this->assertTrue( $this->myxmlrpcserver->login_pass_ok( 'subscriber', 'subscriber' ) );
     26        $this->assertInstanceOf( 'WP_User', $this->myxmlrpcserver->login( 'subscriber', 'subscriber' ) );
     27    }
    1928}
Note: See TracChangeset for help on using the changeset viewer.