Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/14/2021 03:51:15 PM (3 years ago)
Author:
imath
Message:

Group the BP_Activity_Activity::get_id() method params into an array

Deprecate old arguments and add backward compatibility for users still using these.

Props oztaser

Fixes #8596

File:
1 edited

Legend:

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

    r12604 r13150  
    465465        ) );
    466466
    467         $activity = BP_Activity_Activity::get_id( false, false, false, 523, false, false, false, false );
     467        $args = array(
     468            'item_id' => 523,
     469        );
     470
     471        $activity = BP_Activity_Activity::get_id( $args );
    468472        $this->assertEquals( $a1, $activity );
    469473    }
     
    471475    /**
    472476     * @group get_id
     477     * @group BP8596
     478     * @expectedDeprecated BP_Activity_Activity::get_id
     479     */
     480    public function test_get_id_with_deprecated_args() {
     481        $a1 = self::factory()->activity->create( array(
     482            'item_id' => 573,
     483        ) );
     484        $a2 = self::factory()->activity->create( array(
     485            'item_id' => 1098,
     486        ) );
     487
     488        $activity = BP_Activity_Activity::get_id( false, false, false, 1098, false, false, false, false );
     489        $this->assertEquals( $a2, $activity );
     490    }
     491
     492    /**
     493     * @group get_id
    473494     */
    474495    public function test_get_id_with_secondary_item_id() {
     
    480501        ) );
    481502
    482         $activity = BP_Activity_Activity::get_id( false, false, false, false, 523, false, false, false );
     503        $args = array(
     504            'secondary_item_id' => 523,
     505        );
     506
     507        $activity = BP_Activity_Activity::get_id( $args );
    483508        $this->assertEquals( $a1, $activity );
    484509    }
Note: See TracChangeset for help on using the changeset viewer.