Skip to:
Content

BuddyPress.org

Ticket #5589: 5589.02.patch

File 5589.02.patch, 1.2 KB (added by boonebgorges, 11 years ago)
  • bp-xprofile/bp-xprofile-classes.php

    diff --git bp-xprofile/bp-xprofile-classes.php bp-xprofile/bp-xprofile-classes.php
    index 63e4266..522bb45 100644
    class BP_XProfile_Field_Type_Placeholder extends BP_XProfile_Field_Type { 
    25192519         * @since BuddyPress (2.0.1)
    25202520         */
    25212521        public function __construct() {
     2522                $this->set_format( '/.*/', 'replace' );
    25222523        }
    25232524
    25242525        /**
  • tests/testcases/xprofile/class-bp-xprofile-field-type.php

    diff --git tests/testcases/xprofile/class-bp-xprofile-field-type.php tests/testcases/xprofile/class-bp-xprofile-field-type.php
    index 04ace3c..619040e 100644
    class BP_Tests_XProfile_Field_Type extends BP_UnitTestCase { 
    153153                $this->assertFalse( $field->is_valid( '' ) );
    154154                $this->assertTrue( $field->is_valid( array() ) );
    155155        }
     156
     157        /**
     158         * @group BP_XProfile_Field_Group_Type_Placeholder
     159         */
     160        public function test_placeholder_validate_any_value() {
     161                $field = bp_xprofile_create_field_type( 'foo' );
     162                $this->assertTrue( $field->is_valid( '' ) );
     163                $this->assertTrue( $field->is_valid( 'bar' ) );
     164                $this->assertTrue( $field->is_valid( array( 'bar' ) ) );
     165        }
    156166}