Skip to:
Content

BuddyPress.org

Changeset 9679


Ignore:
Timestamp:
04/02/2015 12:19:49 AM (11 years ago)
Author:
johnjamesjacoby
Message:

XProfile: Introduce save_xprofile_group_name test group, for testing slashed data issues. See #6340.

File:
1 edited

Legend:

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

    r9139 r9679  
    100100        $this->assertSame( $e2, array_merge( $found2, array() ) );
    101101    }
     102
     103    /**
     104     * @group save_xprofile_group_name
     105     */
     106    public function test_save_xprofile_group_name() {
     107        $g1 = $this->factory->xprofile_group->create( array(
     108            'name' => "Test ' Name"
     109        ) );
     110
     111        $e1 = new BP_XProfile_Group( $g1 );
     112        $e1->save();
     113
     114        wp_cache_delete( $g1, 'bp_xprofile_groups' );
     115
     116        $e2 = new BP_XProfile_Group( $g1 );
     117
     118        $this->assertEquals( $e1->name, $e2->name );
     119    }
     120
     121    /**
     122     * @group save_xprofile_group_name
     123     */
     124    public function test_save_xprofile_group_name_with_single_quote() {
     125
     126        // Set the original group name with no slashes
     127        $pristine_name = "Test \' Name";
     128
     129        // Create a group
     130        $g1 = $this->factory->xprofile_group->create( array(
     131            'name' => $pristine_name
     132        ) );
     133
     134        // Get the field
     135        $e1 = new BP_XProfile_Group( $g1 );
     136
     137        $this->assertEquals( $pristine_name, $e1->name );
     138    }
    102139}
Note: See TracChangeset for help on using the changeset viewer.