Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/07/2023 07:47:34 AM (14 months ago)
Author:
imath
Message:

Do 404 when trying to reach a page about an unregistered group type

Improves the way we handle this case making sure we really end up to a
404 if the corresponding group type is not registered or do not support
directory filtering. Update corresponding PHP unit tests to really test
this case instead of a case about a member type.

Closes https://github.com/buddypress/buddypress/pull/82
Fixes #8866

File:
1 edited

Legend:

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

    r13433 r13448  
    7575    public function test_group_directory_should_404_for_group_types_that_have_no_directory() {
    7676        $this->set_permalink_structure( '/%postname%/' );
    77         bp_register_member_type( 'foo', array( 'has_directory' => false ) );
    78         $this->go_to( bp_get_members_directory_permalink() . 'type/foo/' );
    79         $this->assertTrue( is_404() );
     77        bp_groups_register_group_type( 'taz', array( 'has_directory' => false ) );
     78        $this->go_to( bp_get_groups_directory_permalink() . 'type/taz/' );
     79        $this->assertEmpty( bp_get_current_group_directory_type() );
    8080    }
    8181
     
    8585    public function test_group_directory_should_404_for_invalid_group_types() {
    8686        $this->set_permalink_structure( '/%postname%/' );
    87         $this->go_to( bp_get_members_directory_permalink() . 'type/foo/' );
    88         $this->assertTrue( is_404() );
     87        $this->go_to( bp_get_groups_directory_permalink() . 'type/zat/' );
     88        $this->assertEmpty( bp_get_current_group_directory_type() );
    8989    }
    9090
Note: See TracChangeset for help on using the changeset viewer.