WordPress.org

Make WordPress Core

Changeset 245 in tests


Ignore:
Timestamp:
10/06/09 19:16:43 (6 years ago)
Author:
westi
Message:

Add some testcases for deletion of post_meta so as to exercise more of the api. Relates to WP #2659

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_post.php

    r243 r245  
    581581        // insert a post 
    582582        $this->post_id = wp_insert_post($post); 
     583 
     584         
     585        $post = array( 
     586            'post_author' => $this->author->ID, 
     587            'post_status' => 'publish', 
     588            'post_content' => rand_str(), 
     589            'post_title' => rand_str(), 
     590        ); 
     591 
     592        // insert a post 
     593        $this->post_id_2 = wp_insert_post($post); 
    583594    } 
    584595 
     
    586597        parent::tearDown(); 
    587598        wp_delete_post($this->post_id); 
     599        wp_delete_post($this->post_id_2); 
    588600    } 
    589601 
     
    668680    } 
    669681     
     682    function test_delete_post_meta() { 
     683        // Add a unique post meta item 
     684        $this->assertTrue(add_post_meta($this->post_id, 'unique_delete', 'value', true)); 
     685        $this->assertTrue(add_post_meta($this->post_id_2, 'unique_delete', 'value', true)); 
     686 
     687        //Check they exists 
     688        $this->assertEquals('value', get_post_meta($this->post_id, 'unique_delete', true)); 
     689        $this->assertEquals('value', get_post_meta($this->post_id_2, 'unique_delete', true)); 
     690     
     691        //Delete one of them 
     692        $this->assertTrue(delete_post_meta($this->post_id, 'unique_delete', 'value')); 
     693 
     694        //Check the other still exitsts 
     695        $this->assertEquals('value', get_post_meta($this->post_id_2, 'unique_delete', true)); 
     696 
     697         
     698    } 
    670699} 
    671700?> 
Note: See TracChangeset for help on using the changeset viewer.