Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/17/2021 12:03:45 PM (3 years ago)
Author:
imath
Message:

Into bp_activity_post_update() do return a WP Error when requested

Props oztaser

Fixes #8587

File:
1 edited

Legend:

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

    r12606 r13128  
    14601460     * @group bp_activity_post_update
    14611461     */
     1462    public function test_bp_activity_post_update_empty_content_wp_error() {
     1463        $activity = bp_activity_post_update( array(
     1464            'user_id'    => 3,
     1465            'error_type' => 'wp_error',
     1466        ) );
     1467
     1468        $this->assertInstanceOf( 'WP_Error', $activity );
     1469        $this->assertEquals( 'bp_activity_missing_content', $activity->get_error_code() );
     1470    }
     1471
     1472    /**
     1473     * @group bp_activity_post_update
     1474     */
    14621475    public function test_bp_activity_post_update_inactive_user() {
    14631476        $this->assertFalse( bp_activity_post_update( array(
     
    14651478            'content' => 'foo',
    14661479        ) ) );
     1480    }
     1481
     1482    /**
     1483     * @group bp_activity_post_update
     1484     */
     1485    public function test_bp_activity_post_update_inactive_user_wp_error() {
     1486        $activity = bp_activity_post_update( array(
     1487            'user_id'    => 3456,
     1488            'content'    => 'foo',
     1489            'error_type' => 'wp_error',
     1490        ) );
     1491
     1492        $this->assertInstanceOf( 'WP_Error', $activity );
     1493        $this->assertEquals( 'bp_activity_inactive_user', $activity->get_error_code() );
    14671494    }
    14681495
Note: See TracChangeset for help on using the changeset viewer.