Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/27/2016 03:07:47 AM (9 years ago)
Author:
imath
Message:

Groups: Make sure BP_Group_Extension::widget_display() can be used

On the single item home (eg: a custom front template), it will now be possible to use bp_custom_group_boxes() to get the content provided by the Group extensions in their widget.

2 unit tests are checking this only happens when on the Groups single item home.

Fixes #7131

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/groups/class-bp-group-extension.php

    r10745 r10905  
    846846        $this->set_current_user( $old_current_user );
    847847    }
     848
     849    /**
     850     * @ticket BP7131
     851     */
     852    public function test_widget_on_group_home_page() {
     853        $g = $this->factory->group->create( array(
     854            'status' => 'public',
     855        ) );
     856        $g_obj = groups_get_group( array( 'group_id' => $g ) );
     857
     858        $this->go_to( bp_get_group_permalink( $g_obj ) );
     859
     860        $e1 = new BPTest_Group_Extension_Widget_Method();
     861        $e1->_register();
     862
     863        ob_start();
     864        bp_custom_group_boxes();
     865        $content = ob_get_clean();
     866
     867        $this->assertTrue( $content === 'Widget Displayed' );
     868    }
     869
     870    /**
     871     * @ticket BP7131
     872     */
     873    public function test_widget_on_group_members_page() {
     874        $g = $this->factory->group->create( array(
     875            'status' => 'public',
     876        ) );
     877        $g_obj = groups_get_group( array( 'group_id' => $g ) );
     878
     879        $this->go_to( trailingslashit( bp_get_group_permalink( $g_obj ) ) . 'members/' );
     880
     881        $e1 = new BPTest_Group_Extension_Widget_Method();
     882        $e1->_register();
     883
     884        ob_start();
     885        bp_custom_group_boxes();
     886        $content = ob_get_clean();
     887
     888        $this->assertFalse( $content === 'Widget Displayed' );
     889    }
    848890}
Note: See TracChangeset for help on using the changeset viewer.