- Timestamp:
- 10/02/2015 09:57:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-field.php
r10004 r10164 5 5 */ 6 6 class BP_Tests_BP_XProfile_Field_TestCases extends BP_UnitTestCase { 7 7 8 8 /** 9 9 * @group xprofile_field_save … … 121 121 $this->assertSame( $new_field_id, $field->id ); 122 122 } 123 124 /** 125 * @ticket BP6638 126 */ 127 public function test_default_visibility_should_be_lazy_loaded() { 128 global $wpdb; 129 130 $group = $this->factory->xprofile_group->create(); 131 $field = $this->factory->xprofile_field->create( array( 132 'field_group_id' => $group, 133 ) ); 134 135 bp_xprofile_update_meta( $field, 'field', 'default_visibility', 'loggedin' ); 136 137 // Initial setup takes just one query. 138 $num_queries = $wpdb->num_queries; 139 $field_obj = new BP_XProfile_Field( $field ); 140 $num_queries++; 141 142 $this->assertSame( $num_queries, $wpdb->num_queries ); 143 144 // Fetching the default_visibility should cause another query. 145 $this->assertSame( 'loggedin', $field_obj->default_visibility ); 146 $num_queries++; 147 148 $this->assertSame( $num_queries, $wpdb->num_queries ); 149 } 150 151 /** 152 * @ticket BP6638 153 */ 154 public function test_allow_custom_visibility_should_be_lazy_loaded() { 155 global $wpdb; 156 157 $group = $this->factory->xprofile_group->create(); 158 $field = $this->factory->xprofile_field->create( array( 159 'field_group_id' => $group, 160 ) ); 161 162 bp_xprofile_update_meta( $field, 'field', 'allow_custom_visibility', 'disabled' ); 163 164 // Initial setup takes just one query. 165 $num_queries = $wpdb->num_queries; 166 $field_obj = new BP_XProfile_Field( $field ); 167 $num_queries++; 168 169 $this->assertSame( $num_queries, $wpdb->num_queries ); 170 171 // Fetching the allow_custom_visibility should cause another query. 172 $this->assertSame( 'disabled', $field_obj->allow_custom_visibility ); 173 $num_queries++; 174 175 $this->assertSame( $num_queries, $wpdb->num_queries ); 176 } 123 177 }
Note: See TracChangeset
for help on using the changeset viewer.