Changeset 7836 for trunk/tests/testcases/xprofile/functions.php
- Timestamp:
- 02/10/2014 04:29:06 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/tests/testcases/xprofile/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/xprofile/functions.php
r7812 r7836 93 93 $this->assertFalse( wp_cache_get( 'fullname_field_id', 'bp_xprofile' ) ); 94 94 } 95 96 /** 97 * @group xprofile_get_field_visibility_level 98 */ 99 public function test_bp_xprofile_get_field_visibility_level_missing_params() { 100 $this->assertSame( '', xprofile_get_field_visibility_level( 0, 1 ) ); 101 $this->assertSame( '', xprofile_get_field_visibility_level( 1, 0 ) ); 102 } 103 104 /** 105 * @group xprofile_get_field_visibility_level 106 */ 107 public function test_bp_xprofile_get_field_visibility_level_user_set() { 108 $u = $this->create_user(); 109 $g = $this->factory->xprofile_group->create(); 110 $f = $this->factory->xprofile_field->create( array( 111 'field_group_id' => $g->id, 112 'type' => 'textbox', 113 ) ); 114 115 bp_xprofile_update_meta( $f->id, 'field', 'default_visibility', 'adminsonly' ); 116 bp_xprofile_update_meta( $f->id, 'field', 'allow_custom_visibility', 'allowed' ); 117 118 xprofile_set_field_visibility_level( $f->id, $u, 'loggedin' ); 119 120 $this->assertSame( 'loggedin', xprofile_get_field_visibility_level( $f->id, $u ) ); 121 } 122 123 /** 124 * @group xprofile_get_field_visibility_level 125 */ 126 public function test_bp_xprofile_get_field_visibility_level_user_unset() { 127 $u = $this->create_user(); 128 $g = $this->factory->xprofile_group->create(); 129 $f = $this->factory->xprofile_field->create( array( 130 'field_group_id' => $g->id, 131 'type' => 'textbox', 132 ) ); 133 134 bp_xprofile_update_meta( $f->id, 'field', 'default_visibility', 'adminsonly' ); 135 bp_xprofile_update_meta( $f->id, 'field', 'allow_custom_visibility', 'allowed' ); 136 137 $this->assertSame( 'adminsonly', xprofile_get_field_visibility_level( $f->id, $u ) ); 138 139 } 140 141 /** 142 * @group xprofile_get_field_visibility_level 143 */ 144 public function test_bp_xprofile_get_field_visibility_level_admin_override() { 145 $u = $this->create_user(); 146 $g = $this->factory->xprofile_group->create(); 147 $f = $this->factory->xprofile_field->create( array( 148 'field_group_id' => $g->id, 149 'type' => 'textbox', 150 ) ); 151 152 bp_xprofile_update_meta( $f->id, 'field', 'default_visibility', 'adminsonly' ); 153 bp_xprofile_update_meta( $f->id, 'field', 'allow_custom_visibility', 'disabled' ); 154 155 xprofile_set_field_visibility_level( $f->id, $u, 'loggedin' ); 156 157 $this->assertSame( 'adminsonly', xprofile_get_field_visibility_level( $f->id, $u ) ); 158 } 95 159 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)