WordPress.org

Make WordPress Core

Changeset 684 in tests


Ignore:
Timestamp:
04/13/12 20:20:20 (2 years ago)
Author:
nacin
Message:

Move from 'featured image' to 'post thumbnail' in the XML-RPC API. see #WP20396.

Location:
wp-testcase/test-xmlrpc-api
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test-xmlrpc-api/test_mw_editPost.php

    r647 r684  
    8585    } 
    8686 
    87     function test_featured_image() { 
     87    function test_post_thumbnail() { 
    8888        add_theme_support( 'post-thumbnails' ); 
    8989 
    9090        $author_id = get_user_by( 'login', 'author' )->ID; 
    91         $post = array( 'post_title' => 'Featured Image Test', 'post_author' => $author_id ); 
     91        $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id ); 
    9292        $post_id = wp_insert_post( $post ); 
    9393 
     
    101101 
    102102        $attachment = array( 
    103             'post_title' => 'Featured Image', 
     103            'post_title' => 'Post Thumbnail', 
    104104            'post_type' => 'attachment', 
    105105            'post_mime_type' => 'image/jpeg', 
     
    108108        $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id ); 
    109109 
    110         // add featured image to post that does not have one 
    111         $post2 = array( 'wp_featured_image' => $attachment_id ); 
     110        // add post thumbnail to post that does not have one 
     111        $post2 = array( 'wp_post_thumbnail' => $attachment_id ); 
    112112        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post2 ) ); 
    113113        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
    114114        $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 
    115115 
    116         // edit the post without supplying a featured_image and check that it didn't change 
     116        // edit the post without supplying a post_thumbnail and check that it didn't change 
    117117        $post3 = array( 'post_content' => 'Updated post' ); 
    118118        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post3 ) ); 
     
    121121 
    122122        // create another attachment 
    123         $attachment2 = array_merge( $attachment, array( 'title' => 'Featured Image 2' ) ); 
     123        $attachment2 = array_merge( $attachment, array( 'title' => 'Post Thumbnail 2' ) ); 
    124124        $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id ); 
    125125 
    126         // change the post's featured_image 
    127         $post4 = array( 'wp_featured_image' => $attachment2_id ); 
     126        // change the post's post_thumbnail 
     127        $post4 = array( 'wp_post_thumbnail' => $attachment2_id ); 
    128128        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post4 ) ); 
    129129        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
    130130        $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 
    131131 
    132         // unset the post's featured_image 
    133         $post5 = array( 'wp_featured_image' => '' ); 
     132        // unset the post's post_thumbnail 
     133        $post5 = array( 'wp_post_thumbnail' => '' ); 
    134134        $result = $this->myxmlrpcserver->mw_editPost( array($post_id, 'author', 'author', $post5 ) ); 
    135135        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
  • wp-testcase/test-xmlrpc-api/test_mw_getPost.php

    r647 r684  
    8888        $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id ); 
    8989 
    90         $this->assertEquals( '', $result['wp_featured_image'] ); 
    91         $this->assertEquals( '', $result['wp_featured_image_url'] ); 
     90        $this->assertEquals( '', $result['wp_post_thumbnail'] ); 
     91        $this->assertEquals( '', $result['wp_post_thumbnail_url'] ); 
    9292 
    9393        remove_theme_support( 'post-thumbnails' ); 
    9494    } 
    9595 
    96     function test_featured_image() { 
     96    function test_post_thumbnail() { 
    9797        add_theme_support( 'post-thumbnails' ); 
    9898 
     
    104104 
    105105        $attachment = array( 
    106             'post_title' => 'Featured Image', 
     106            'post_title' => 'Post Thumbnail', 
    107107            'post_type' => 'attachment', 
    108108            'post_mime_type' => 'image/jpeg', 
     
    117117        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
    118118 
    119         $this->assertInternalType( 'string', $result['wp_featured_image'] ); 
    120         $this->assertStringMatchesFormat( '%d', $result['wp_featured_image'] ); 
    121         $this->assertEquals( $attachment_id, $result['wp_featured_image'] ); 
     119        $this->assertInternalType( 'string', $result['wp_post_thumbnail'] ); 
     120        $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] ); 
     121        $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] ); 
    122122 
    123         $this->assertInternalType( 'string', $result['wp_featured_image_url'] ); 
    124         $this->assertEquals( wp_get_attachment_url( $attachment_id ), $result['wp_featured_image_url'] ); 
     123        $this->assertInternalType( 'string', $result['wp_post_thumbnail_url'] ); 
     124        $this->assertEquals( wp_get_attachment_url( $attachment_id ), $result['wp_post_thumbnail_url'] ); 
    125125 
    126126        delete_post_thumbnail( $this->post_id ); 
  • wp-testcase/test-xmlrpc-api/test_mw_getRecentPosts.php

    r647 r684  
    8484            $this->assertEquals( url_to_postid( $result['link'] ), $post->ID ); 
    8585 
    86             $this->assertEquals( '', $result['wp_featured_image'] ); 
    87             $this->assertEquals( '', $result['wp_featured_image_url'] ); 
     86            $this->assertEquals( '', $result['wp_post_thumbnail'] ); 
     87            $this->assertEquals( '', $result['wp_post_thumbnail_url'] ); 
    8888        } 
    8989 
     
    9191    } 
    9292 
    93     function test_featured_image() { 
     93    function test_post_thumbnail() { 
    9494        add_theme_support( 'post-thumbnails' ); 
    9595 
     
    101101 
    102102        $attachment = array( 
    103             'post_title' => 'Featured Image', 
     103            'post_title' => 'Post Thumbnail', 
    104104            'post_type' => 'attachment', 
    105105            'post_mime_type' => 'image/jpeg', 
     
    113113 
    114114        foreach( $results as $result ) { 
    115             $this->assertInternalType( 'string', $result['wp_featured_image'] ); 
    116             $this->assertStringMatchesFormat( '%d', $result['wp_featured_image'] ); 
    117             $this->assertInternalType( 'string', $result['wp_featured_image_url'] ); 
     115            $this->assertInternalType( 'string', $result['wp_post_thumbnail'] ); 
     116            $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] ); 
     117            $this->assertInternalType( 'string', $result['wp_post_thumbnail_url'] ); 
    118118 
    119             if( ! empty( $result['wp_featured_image'] ) || $result['postid'] == $this->post_id ) { 
     119            if( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == $this->post_id ) { 
    120120                $attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true ); 
    121121 
    122                 $this->assertEquals( $attachment_id, $result['wp_featured_image'] ); 
    123                 $this->assertEquals( wp_get_attachment_url( $attachment_id ), $result['wp_featured_image_url'] ); 
     122                $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] ); 
     123                $this->assertEquals( wp_get_attachment_url( $attachment_id ), $result['wp_post_thumbnail_url'] ); 
    124124            } 
    125125        } 
  • wp-testcase/test-xmlrpc-api/test_mw_newPost.php

    r647 r684  
    8484    } 
    8585 
    86     function test_featured_image() { 
     86    function test_post_thumbnail() { 
    8787        add_theme_support( 'post-thumbnails' ); 
    8888 
     
    9494 
    9595        $attachment = array( 
    96             'post_title' => 'Featured Image', 
     96            'post_title' => 'Post Thumbnail', 
    9797            'post_type' => 'attachment', 
    9898            'post_mime_type' => 'image/jpeg', 
     
    101101        $attachment_id = wp_insert_attachment( $attachment, $upload['file'] ); 
    102102 
    103         $post = array( 'title' => 'Featured Image Test', 'wp_featured_image' => $attachment_id ); 
     103        $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id ); 
    104104        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 
    105105        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
  • wp-testcase/test-xmlrpc-api/test_wp_editPost.php

    r647 r684  
    8585    } 
    8686 
    87     function test_featured_image() { 
     87    function test_post_thumbnail() { 
    8888        add_theme_support( 'post-thumbnails' ); 
    8989 
    9090        $author_id = get_user_by( 'login', 'author' )->ID; 
    91         $post = array( 'post_title' => 'Featured Image Test', 'post_author' => $author_id ); 
     91        $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id ); 
    9292        $post_id = wp_insert_post( $post ); 
    9393 
     
    101101 
    102102        $attachment = array( 
    103             'post_title' => 'Featured Image', 
     103            'post_title' => 'Post Thumbnail', 
    104104            'post_type' => 'attachment', 
    105105            'post_mime_type' => 'image/jpeg', 
     
    108108        $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id ); 
    109109 
    110         // add featured image to post that does not have one 
    111         $post2 = array( 'featured_image' => $attachment_id ); 
     110        // add post thumbnail to post that does not have one 
     111        $post2 = array( 'post_thumbnail' => $attachment_id ); 
    112112        $result = $this->myxmlrpcserver->wp_editPost( array(1, 'author', 'author', $post_id, $post2 ) ); 
    113113        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
    114114        $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 
    115115 
    116         // edit the post without supplying a featured_image and check that it didn't change 
     116        // edit the post without supplying a post_thumbnail and check that it didn't change 
    117117        $post3 = array( 'post_content' => 'Updated post' ); 
    118118        $result = $this->myxmlrpcserver->wp_editPost( array(1, 'author', 'author', $post_id, $post3 ) ); 
     
    121121 
    122122        // create another attachment 
    123         $attachment2 = array_merge( $attachment, array( 'post_title' => 'Featured Image 2' ) ); 
     123        $attachment2 = array_merge( $attachment, array( 'post_title' => 'Post Thumbnail 2' ) ); 
    124124        $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id ); 
    125125 
    126         // change the post's featured_image 
    127         $post4 = array( 'featured_image' => $attachment2_id ); 
     126        // change the post's post_thumbnail 
     127        $post4 = array( 'post_thumbnail' => $attachment2_id ); 
    128128        $result = $this->myxmlrpcserver->wp_editPost( array(1, 'author', 'author', $post_id, $post4 ) ); 
    129129        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
    130130        $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 
    131131 
    132         // unset the post's featured_image 
    133         $post5 = array( 'featured_image' => '' ); 
     132        // unset the post's post_thumbnail 
     133        $post5 = array( 'post_thumbnail' => '' ); 
    134134        $result = $this->myxmlrpcserver->wp_editPost( array(1, 'author', 'author', $post_id, $post5 ) ); 
    135135        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
  • wp-testcase/test-xmlrpc-api/test_wp_getOptions.php

    r568 r684  
    5858        $this->assertTrue( $result['stylesheet']['readonly'] ); 
    5959 
    60         $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['featured_image']['value'] ); 
    61         $this->assertTrue( $result['featured_image']['readonly'] ); 
     60        $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] ); 
     61        $this->assertTrue( $result['post_thumbnail']['readonly'] ); 
    6262 
    6363        // Updatable options 
     
    141141        $this->assertTrue( $result['stylesheet']['readonly'] ); 
    142142 
    143         $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['featured_image']['value'] ); 
    144         $this->assertTrue( $result['featured_image']['readonly'] ); 
     143        $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] ); 
     144        $this->assertTrue( $result['post_thumbnail']['readonly'] ); 
    145145 
    146146        // Updatable options 
  • wp-testcase/test-xmlrpc-api/test_wp_getPost.php

    r603 r684  
    6060        $this->assertInternalType( 'bool', $result['sticky'] ); 
    6161        $this->assertInternalType( 'string', $result['post_format'] ); 
    62         $this->assertInternalType( 'string', $result['featured_image'] ); 
     62        $this->assertInternalType( 'string', $result['post_thumbnail'] ); 
    6363 
    6464        // Check expected values 
     
    7171        $this->assertEquals( $this->post_data['post_content'], $result['post_content'] ); 
    7272        $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id ); 
    73         $this->assertEquals( '', $result['featured_image'] ); 
     73        $this->assertEquals( '', $result['post_thumbnail'] ); 
    7474 
    7575        remove_theme_support( 'post-thumbnails' ); 
  • wp-testcase/test-xmlrpc-api/test_wp_newPost.php

    r647 r684  
    8383    } 
    8484 
    85     function test_featured_image() { 
     85    function test_post_thumbnail() { 
    8686        add_theme_support( 'post-thumbnails' ); 
    8787 
     
    9393 
    9494        $attachment = array( 
    95             'post_title' => 'Featured Image', 
     95            'post_title' => 'Post Thumbnail', 
    9696            'post_type' => 'attachment', 
    9797            'post_mime_type' => 'image/jpeg', 
     
    100100        $attachment_id = wp_insert_attachment( $attachment, $upload['file'] ); 
    101101 
    102         $post = array( 'post_title' => 'Featured Image Test', 'featured_image' => $attachment_id ); 
     102        $post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id ); 
    103103        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 
    104104        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
Note: See TracChangeset for help on using the changeset viewer.