Make WordPress Core

Changeset 385 in tests for wp-testcase/test_includes_post.php


Ignore:
Timestamp:
08/02/2011 08:45:42 PM (14 years ago)
Author:
ryan
Message:

add_post_meta() now returns the mid instead of true

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_post.php

    r366 r385  
    645645    function test_unique_postmeta() {
    646646        // Add a unique post meta item
    647         $this->assertTrue(add_post_meta($this->post_id, 'unique', 'value', true));
     647        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique', 'value', true) );
    648648       
    649649        // Check unique is enforced
     
    668668    function test_nonunique_postmeta() {
    669669        // Add two non unique post meta item
    670         $this->assertTrue(add_post_meta($this->post_id, 'nonunique', 'value'));
    671         $this->assertTrue(add_post_meta($this->post_id, 'nonunique', 'another value'));
     670        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique', 'value') );
     671        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique', 'another value'));
    672672       
    673673        //Check they exists
     
    686686       
    687687        //Add a third one
    688         $this->assertTrue(add_post_meta($this->post_id, 'nonunique', 'someother value'));
     688        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique', 'someother value') );
    689689       
    690690        //Check they exists
     
    698698    function test_update_post_meta() {
    699699        // Add a unique post meta item
    700         $this->assertTrue(add_post_meta($this->post_id, 'unique_update', 'value', true));
     700        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique_update', 'value', true) );
    701701
    702702        // Add two non unique post meta item
    703         $this->assertTrue(add_post_meta($this->post_id, 'nonunique_update', 'value'));
    704         $this->assertTrue(add_post_meta($this->post_id, 'nonunique_update', 'another value'));
    705        
     703        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique_update', 'value') );
     704        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique_update', 'another value') );
     705
    706706        //Check they exists
    707707        $this->assertEquals('value', get_post_meta($this->post_id, 'unique_update', true));
     
    725725    function test_delete_post_meta() {
    726726        // Add a unique post meta item
    727         $this->assertTrue(add_post_meta($this->post_id, 'unique_delete', 'value', true));
    728         $this->assertTrue(add_post_meta($this->post_id_2, 'unique_delete', 'value', true));
     727        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique_delete', 'value', true) );
     728        $this->assertInternalType( 'integer', add_post_meta($this->post_id_2, 'unique_delete', 'value', true) );
    729729
    730730        //Check they exists
     
    743743    function test_delete_post_meta_by_key() {
    744744        // Add a unique post meta item
    745         $this->assertTrue(add_post_meta($this->post_id, 'unique_delete_by_key', 'value', true));
    746         $this->assertTrue(add_post_meta($this->post_id_2, 'unique_delete_by_key', 'value', true));
    747 
    748         //Check they exists
     745        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique_delete_by_key', 'value', true) );
     746        $this->assertInternalType( 'integer', add_post_meta($this->post_id_2, 'unique_delete_by_key', 'value', true) );
     747
     748        //Check they exist
    749749        $this->assertEquals('value', get_post_meta($this->post_id, 'unique_delete_by_key', true));
    750750        $this->assertEquals('value', get_post_meta($this->post_id_2, 'unique_delete_by_key', true));
     
    753753        $this->assertTrue(delete_post_meta_by_key('unique_delete_by_key'));
    754754
    755         //Check the other still exitsts
     755        //Check the other still exists
    756756        $this->assertEquals('', get_post_meta($this->post_id_2, 'unique_delete_by_key', true));
    757757        $this->assertEquals('', get_post_meta($this->post_id_2, 'unique_delete_by_key', true));
     
    772772       
    773773        // Add a post meta item
    774         $this->assertTrue(add_post_meta($this->post_id, 'test_funky_post_meta', $funky_meta, true));
     774        $this->assertInternalType( 'integer', add_post_meta($this->post_id, 'test_funky_post_meta', $funky_meta, true) );
    775775
    776776        //Check they exists
Note: See TracChangeset for help on using the changeset viewer.