Skip to:
Content

BuddyPress.org

Changeset 7887


Ignore:
Timestamp:
02/14/2014 07:51:11 PM (10 years ago)
Author:
boonebgorges
Message:

Don't test prev_value return value on WP < 3.7

There was a bug prior to WP 3.7 that caused update_metadata() to return true
even when the update failed due to a 'prev_value' parameter not being matched.
Since this is not really a functionality issue, but is more about error
reporting, it doesn't affect end-user functionality in BP, except insofar as
the function will return an unexpected value in those cases. Instead of coming
up with an arcane workaround for these old versions, we'll just skip the tests
for the time being.

See https://core.trac.wordpress.org/ticket/24933 for background on the WP issue

Location:
trunk/tests/testcases
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/activity/functions.php

    r7885 r7887  
    199199        $a = $this->factory->activity->create();
    200200        bp_activity_add_meta( $a, 'foo', 'bar' );
    201         $this->assertFalse( bp_activity_update_meta( $a, 'foo', 'bar2', 'baz' ) );
     201
     202        // In earlier versions of WordPress, bp_activity_update_meta()
     203        // returns true even on failure. However, we know that in these
     204        // cases the update is failing as expected, so we skip this
     205        // assertion just to keep our tests passing
     206        // See https://core.trac.wordpress.org/ticket/24933
     207        if ( version_compare( $GLOBALS['wp_version'], '3.7', '>=' ) ) {
     208            $this->assertFalse( bp_activity_update_meta( $a, 'foo', 'bar2', 'baz' ) );
     209        }
     210
    202211        $this->assertTrue( bp_activity_update_meta( $a, 'foo', 'bar2', 'bar' ) );
    203212    }
  • trunk/tests/testcases/blogs/functions.php

    r7885 r7887  
    220220    public function test_bp_blogs_update_meta_prev_value() {
    221221        bp_blogs_add_blogmeta( 1, 'foo', 'bar' );
    222         $this->assertFalse( bp_blogs_update_blogmeta( 1, 'foo', 'bar2', 'baz' ) );
     222
     223        // In earlier versions of WordPress, bp_activity_update_meta()
     224        // returns true even on failure. However, we know that in these
     225        // cases the update is failing as expected, so we skip this
     226        // assertion just to keep our tests passing
     227        // See https://core.trac.wordpress.org/ticket/24933
     228        if ( version_compare( $GLOBALS['wp_version'], '3.7', '>=' ) ) {
     229            $this->assertFalse( bp_blogs_update_blogmeta( 1, 'foo', 'bar2', 'baz' ) );
     230        }
     231
    223232        $this->assertTrue( bp_blogs_update_blogmeta( 1, 'foo', 'bar2', 'bar' ) );
    224233    }
  • trunk/tests/testcases/groups/functions.php

    r7885 r7887  
    342342        $g = $this->factory->group->create();
    343343        groups_add_groupmeta( $g, 'foo', 'bar' );
    344         $this->assertFalse( groups_update_groupmeta( $g, 'foo', 'bar2', 'baz' ) );
     344
     345        // In earlier versions of WordPress, bp_activity_update_meta()
     346        // returns true even on failure. However, we know that in these
     347        // cases the update is failing as expected, so we skip this
     348        // assertion just to keep our tests passing
     349        // See https://core.trac.wordpress.org/ticket/24933
     350        if ( version_compare( $GLOBALS['wp_version'], '3.7', '>=' ) ) {
     351            $this->assertFalse( groups_update_groupmeta( $g, 'foo', 'bar2', 'baz' ) );
     352        }
     353
    345354        $this->assertTrue( groups_update_groupmeta( $g, 'foo', 'bar2', 'bar' ) );
    346355    }
  • trunk/tests/testcases/xprofile/functions.php

    r7885 r7887  
    448448        $g = $this->factory->xprofile_group->create();
    449449        bp_xprofile_add_meta( $g, 'group', 'foo', 'bar' );
    450         $this->assertFalse( bp_xprofile_update_meta( $g, 'group', 'foo', 'bar2', 'baz' ) );
     450
     451        // In earlier versions of WordPress, bp_activity_update_meta()
     452        // returns true even on failure. However, we know that in these
     453        // cases the update is failing as expected, so we skip this
     454        // assertion just to keep our tests passing
     455        // See https://core.trac.wordpress.org/ticket/24933
     456        if ( version_compare( $GLOBALS['wp_version'], '3.7', '>=' ) ) {
     457            $this->assertFalse( bp_xprofile_update_meta( $g, 'group', 'foo', 'bar2', 'baz' ) );
     458        }
     459
    451460        $this->assertTrue( bp_xprofile_update_meta( $g, 'group', 'foo', 'bar2', 'bar' ) );
    452461    }
Note: See TracChangeset for help on using the changeset viewer.