Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/03/2017 07:44:10 PM (7 years ago)
Author:
boonebgorges
Message:

Use static factory method throughout PHPUnit tests.

See #7620.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/groups/types.php

    r11144 r11737  
    107107
    108108    public function test_groups_set_type_success() {
    109         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     109        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    110110        bp_groups_register_group_type( 'foo' );
    111111
     
    114114
    115115    public function test_groups_set_type_should_remove_type_when_passing_an_empty_value() {
    116         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     116        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    117117        bp_groups_register_group_type( 'foo' );
    118118        bp_groups_set_group_type( $g, 'foo' );
     
    126126
    127127    public function test_groups_get_type_with_default_value_for_single() {
    128         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     128        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    129129        bp_groups_register_group_type( 'foo' );
    130130        bp_groups_register_group_type( 'bar' );
     
    136136
    137137    public function test_groups_get_type_with_single_true() {
    138         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     138        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    139139        bp_groups_register_group_type( 'foo' );
    140140        bp_groups_register_group_type( 'bar' );
     
    146146
    147147    public function test_groups_get_type_with_single_false() {
    148         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     148        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    149149        bp_groups_register_group_type( 'foo' );
    150150        bp_groups_register_group_type( 'bar' );
     
    156156
    157157    public function test_groups_get_type_should_return_false_when_no_value_is_found() {
    158         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     158        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    159159        bp_groups_register_group_type( 'foo' );
    160160
     
    171171
    172172    public function test_groups_remove_type_should_return_false_when_group_is_not_of_provided_type() {
    173         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     173        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    174174        bp_groups_register_group_type( 'foo' );
    175175        bp_groups_register_group_type( 'bar' );
     
    181181
    182182    public function tests_groups_remove_type_should_return_true_on_successful_deletion() {
    183         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     183        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    184184        bp_groups_register_group_type( 'foo' );
    185185        bp_groups_register_group_type( 'bar' );
     
    206206
    207207    public function test_groups_has_type_should_return_false_when_group_is_not_of_provided_type() {
    208         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     208        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    209209        bp_groups_register_group_type( 'foo' );
    210210        bp_groups_register_group_type( 'bar' );
     
    215215
    216216    public function test_groups_has_type_should_return_true_on_success() {
    217         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     217        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    218218        bp_groups_register_group_type( 'foo' );
    219219        bp_groups_register_group_type( 'bar' );
     
    229229     */
    230230    public function test_groups_get_type_should_hit_cache() {
    231         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     231        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    232232        bp_groups_register_group_type( 'foo' );
    233233        bp_groups_set_group_type( $g, 'foo' );
     
    254254
    255255    public function test_groups_get_type_should_not_return_unregistered_types() {
    256         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     256        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    257257        bp_groups_register_group_type( 'foo' );
    258258        bp_groups_set_group_type( $g, 'foo' );
     
    291291
    292292    public function test_bp_groups_set_group_type_should_remove_types_when_passing_an_empty_value() {
    293         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     293        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    294294        bp_groups_register_group_type( 'foo' );
    295295        bp_groups_set_group_type( $g, 'foo' );
     
    303303
    304304    public function test_bp_groups_set_group_type_should_set_multiple_types_when_passing_array_of_types() {
    305         $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     305        $g = self::factory()->group->create( array( 'creator_id' => self::$u1 ) );
    306306        bp_groups_register_group_type( 'foo' );
    307307        bp_groups_register_group_type( 'bar' );
Note: See TracChangeset for help on using the changeset viewer.