Skip to:
Content

BuddyPress.org

Changeset 8633


Ignore:
Timestamp:
07/16/2014 10:34:38 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Add unit test for URL field type. Props williamsba1. See #5501.

File:
1 edited

Legend:

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

    r8347 r8633  
    156156
    157157        /**
     158         * @group url
     159         */
     160        public function test_url_validate_url() {
     161                $field = bp_xprofile_create_field_type( 'url' );
     162
     163                $this->assertTrue( $field->is_valid( 'http://foo.com' ) );
     164                $this->assertTrue( $field->is_valid( 'https://foo.com' ) );
     165                $this->assertTrue( $field->is_valid( 'http://foo.bar.com' ) );
     166                $this->assertTrue( $field->is_valid( 'http://foo.bar.com/' ) );
     167                $this->assertTrue( $field->is_valid( 'http://foo.com/bar' ) );
     168                $this->assertTrue( $field->is_valid( 'http://foo.com/index.php' ) );
     169                $this->assertTrue( $field->is_valid( 'http://foo.com/?bar=baz' ) );
     170
     171                $this->assertFalse( $field->is_valid( 'htp://foo.com' ) );
     172                $this->assertFalse( $field->is_valid( 'http:/foo.com' ) );
     173                $this->assertFalse( $field->is_valid( 'http//foo.com' ) );
     174                $this->assertFalse( $field->is_valid( 'http://foo' ) );
     175                $this->assertFalse( $field->is_valid( 'foo.com' ) );
     176        }
     177
     178        /**
    158179         * @group BP_XProfile_Field_Group_Type_Placeholder
    159180         */
Note: See TracChangeset for help on using the changeset viewer.