Changeset 10198 for trunk/tests/phpunit/testcases/xprofile/functions.php
- Timestamp:
- 10/07/2015 02:30:31 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/xprofile/functions.php
r10143 r10198 869 869 $this->assertEquals( array( 1, $g1, $g3, $g2 ), wp_list_pluck( $field_groups, 'id' ) ); 870 870 } 871 872 /** 873 * @ticket BP6638 874 */ 875 public function test_xprofile_get_field_should_return_bp_xprofile_field_object() { 876 global $wpdb; 877 878 $g = $this->factory->xprofile_group->create(); 879 $f = $this->factory->xprofile_field->create( array( 880 'field_group_id' => $g, 881 'type' => 'selectbox', 882 'name' => 'Foo', 883 ) ); 884 885 $field = xprofile_get_field( $f ); 886 887 $this->assertTrue( $field instanceof BP_XProfile_Field ); 888 } 889 890 /** 891 * @ticket BP6638 892 * @group cache 893 */ 894 public function test_xprofile_get_field_should_prime_field_cache() { 895 global $wpdb; 896 897 $g = $this->factory->xprofile_group->create(); 898 $f = $this->factory->xprofile_field->create( array( 899 'field_group_id' => $g, 900 'type' => 'selectbox', 901 'name' => 'Foo', 902 ) ); 903 904 $num_queries = $wpdb->num_queries; 905 906 // Prime the cache. 907 $field_1 = xprofile_get_field( $f ); 908 $num_queries++; 909 $this->assertSame( $num_queries, $wpdb->num_queries ); 910 911 // No more queries. 912 $field_2 = xprofile_get_field( $f ); 913 $this->assertEquals( $field_1, $field_2 ); 914 $this->assertSame( $num_queries, $wpdb->num_queries ); 915 } 871 916 }
Note: See TracChangeset
for help on using the changeset viewer.