- Timestamp:
- 03/21/2021 02:17:21 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-field-type.php
r12697 r12868 1 1 <?php 2 // Include the xProfile Test Type 3 include_once BP_TESTS_DIR . 'assets/bptest-xprofile-field-type.php'; 4 2 5 /** 3 6 * @group xprofile … … 5 8 */ 6 9 class BP_Tests_XProfile_Field_Type extends BP_UnitTestCase { 10 11 public function setUp() { 12 parent::setUp(); 13 14 add_filter( 'bp_xprofile_get_field_types', array( $this, 'get_field_types' ) ); 15 } 16 17 public function tearDown() { 18 parent::tearDown(); 19 20 remove_filter( 'bp_xprofile_get_field_types', array( $this, 'get_field_types' ) ); 21 } 22 7 23 public function test_unregistered_field_type_returns_textbox() { 8 24 $field = bp_xprofile_create_field_type( 'fakeyfield' ); … … 184 200 $this->assertTrue( $field->is_valid( '(212) 664-7665' ) ); 185 201 } 202 203 /** 204 * @ticket BP7162 205 */ 206 public function test_xprofile_field_type_test_supports() { 207 $group_id = self::factory()->xprofile_group->create(); 208 $field_id = self::factory()->xprofile_field->create( 209 array( 210 'field_group_id' => $group_id, 211 'type' => 'test-field-type', 212 'name' => 'Test Supports', 213 ) 214 ); 215 216 $field = xprofile_get_field( $field_id, null, false ); 217 218 $this->assertTrue( $field->field_type_supports( 'switch_fieldtype' ) ); 219 $this->assertFalse( $field->field_type_supports( 'do_autolink' ) ); 220 $this->assertFalse( $field->field_type_supports( 'allow_custom_visibility' ) ); 221 $this->assertTrue( $field->field_type_supports( 'required' ) ); 222 $this->assertTrue( $field->field_type_supports( 'member_types' ) ); 223 $this->assertEquals( 'adminsonly', $field->get_default_visibility() ); 224 } 225 226 public function get_field_types( $types ) { 227 $types['test-field-type'] = 'BPTest_XProfile_Field_Type'; 228 return $types; 229 } 186 230 }
Note: See TracChangeset
for help on using the changeset viewer.