WordPress.org

Make WordPress Core

Changeset 454 in tests


Ignore:
Timestamp:
10/14/11 09:21:36 (3 years ago)
Author:
duck_
Message:

Update a number of deprecated functions with their replacements.

is_taxonomy -> taxonomy_exists, is_term -> term_exists, get_userdatabylogin -> get_user_by

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_meta.php

    r445 r454  
    44    function setUp() { 
    55        parent::setUp(); 
    6         $this->author = get_userdatabylogin(WP_USER_NAME); 
     6        $this->author = get_user_by( 'login', WP_USER_NAME ); 
    77        $this->post_ids = array(); 
    88        $this->meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value' ); 
  • wp-testcase/test_includes_post.php

    r412 r454  
    614614        parent::setUp(); 
    615615 
    616         $this->author = get_userdatabylogin(WP_USER_NAME); 
     616        $this->author = get_user_by( 'login', WP_USER_NAME ); 
    617617 
    618618        $post = array( 
  • wp-testcase/test_includes_taxonomy.php

    r432 r454  
    4040    } 
    4141 
    42     function test_is_taxonomy_known() { 
    43         $this->assertTrue( is_taxonomy('category') ); 
    44         $this->assertTrue( is_taxonomy('post_tag') ); 
    45         $this->assertTrue( is_taxonomy('link_category') ); 
    46     } 
    47  
    48     function test_is_taxonomy_unknown() { 
    49         $this->assertFalse( is_taxonomy(rand_str()) ); 
    50         $this->assertFalse( is_taxonomy('') ); 
    51         $this->assertFalse( is_taxonomy(0) ); 
    52         $this->assertFalse( is_taxonomy(NULL) ); 
     42    function test_taxonomy_exists_known() { 
     43        $this->assertTrue( taxonomy_exists('category') ); 
     44        $this->assertTrue( taxonomy_exists('post_tag') ); 
     45        $this->assertTrue( taxonomy_exists('link_category') ); 
     46    } 
     47 
     48    function test_taxonomy_exists_unknown() { 
     49        $this->assertFalse( taxonomy_exists(rand_str()) ); 
     50        $this->assertFalse( taxonomy_exists('') ); 
     51        $this->assertFalse( taxonomy_exists(0) ); 
     52        $this->assertFalse( taxonomy_exists(NULL) ); 
    5353    } 
    5454 
     
    7070        // make up a new taxonomy name, and ensure it's unused 
    7171        $tax = rand_str(); 
    72         $this->assertFalse( is_taxonomy($tax) ); 
     72        $this->assertFalse( taxonomy_exists($tax) ); 
    7373 
    7474        register_taxonomy( $tax, 'post' ); 
    75         $this->assertTrue( is_taxonomy($tax) ); 
     75        $this->assertTrue( taxonomy_exists($tax) ); 
    7676        $this->assertFalse( is_taxonomy_hierarchical($tax) ); 
    7777 
     
    8484        // make up a new taxonomy name, and ensure it's unused 
    8585        $tax = rand_str(); 
    86         $this->assertFalse( is_taxonomy($tax) ); 
     86        $this->assertFalse( taxonomy_exists($tax) ); 
    8787 
    8888        register_taxonomy( $tax, 'post', array('hierarchical'=>true) ); 
    89         $this->assertTrue( is_taxonomy($tax) ); 
     89        $this->assertTrue( taxonomy_exists($tax) ); 
    9090        $this->assertTrue( is_taxonomy_hierarchical($tax) ); 
    9191 
     
    110110        // a new unused term 
    111111        $term = rand_str(); 
    112         $this->assertNull( is_term($term) ); 
     112        $this->assertNull( term_exists($term) ); 
    113113 
    114114        $initial_count = wp_count_terms( $this->taxonomy ); 
     
    122122 
    123123        // make sure the term exists 
    124         $this->assertTrue( is_term($term) > 0 ); 
    125         $this->assertTrue( is_term($t['term_id']) > 0 ); 
     124        $this->assertTrue( term_exists($term) > 0 ); 
     125        $this->assertTrue( term_exists($t['term_id']) > 0 ); 
    126126 
    127127        // now delete it 
    128128        $this->assertTrue( wp_delete_term($t['term_id'], $this->taxonomy) ); 
    129         $this->assertNull( is_term($term) ); 
    130         $this->assertNull( is_term($t['term_id']) ); 
     129        $this->assertNull( term_exists($term) ); 
     130        $this->assertNull( term_exists($t['term_id']) ); 
    131131        $this->assertEquals( $initial_count, wp_count_terms($this->taxonomy) ); 
    132132    } 
    133133 
    134     function test_is_term_known() { 
     134    function test_term_exists_known() { 
    135135        // insert a term 
    136136        $term = rand_str(); 
    137137        $t = wp_insert_term( $term, $this->taxonomy ); 
    138138 
    139         $this->assertEquals( $t['term_id'], is_term($t['term_id']) ); 
    140         $this->assertEquals( $t['term_id'], is_term($term) ); 
     139        $this->assertEquals( $t['term_id'], term_exists($t['term_id']) ); 
     140        $this->assertEquals( $t['term_id'], term_exists($term) ); 
    141141 
    142142        // clean up 
     
    144144    } 
    145145 
    146     function test_is_term_unknown() { 
    147         $this->assertNull( is_term(rand_str()) ); 
    148         $this->assertEquals( 0, is_term(0) ); 
    149         $this->assertEquals( 0, is_term('') ); 
    150         $this->assertEquals( 0, is_term(NULL) ); 
     146    function test_term_exists_unknown() { 
     147        $this->assertNull( term_exists(rand_str()) ); 
     148        $this->assertEquals( 0, term_exists(0) ); 
     149        $this->assertEquals( 0, term_exists('') ); 
     150        $this->assertEquals( 0, term_exists(NULL) ); 
    151151    } 
    152152 
     
    158158 
    159159        $term_obj = get_term_by('name', $term, $this->taxonomy); 
    160         $this->assertEquals( $t['term_id'], is_term($term_obj->term_id) ); 
     160        $this->assertEquals( $t['term_id'], term_exists($term_obj->term_id) ); 
    161161 
    162162        // clean up 
  • wp-testdata/sample_blogs.php

    r361 r454  
    1212        parent::setUp(); 
    1313 
    14         $this->author = get_userdatabylogin( WP_USER_NAME ); 
     14        $this->author = get_user_by( 'login', WP_USER_NAME ); 
    1515        $this->_delete_all_posts(); 
    1616        update_option('home', 'http://example.com'); 
Note: See TracChangeset for help on using the changeset viewer.