Changeset 49538 for trunk/tests/phpunit/tests/multisite/siteQuery.php
- Timestamp:
- 11/08/2020 11:45:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/siteQuery.php
r49030 r49538 1096 1096 return array( 555 ); 1097 1097 } 1098 1099 /** 1100 * @ticket 51333 1101 */ 1102 public function test_sites_pre_query_filter_should_set_sites_property() { 1103 add_filter( 'sites_pre_query', array( __CLASS__, 'filter_sites_pre_query_and_set_sites' ), 10, 2 ); 1104 1105 $q = new WP_Site_Query(); 1106 $results = $q->query( array() ); 1107 1108 remove_filter( 'sites_pre_query', array( __CLASS__, 'filter_sites_pre_query_and_set_sites' ), 10 ); 1109 1110 // Make sure the sites property is the same as the results. 1111 $this->assertSame( $results, $q->sites ); 1112 1113 // Make sure the site domain is `wordpress.org`. 1114 $this->assertSame( 'wordpress.org', $q->sites[0]->domain ); 1115 } 1116 1117 public static function filter_sites_pre_query_and_set_sites( $sites, $query ) { 1118 return array( get_site( self::$site_ids['wordpress.org/'] ) ); 1119 } 1098 1120 } 1099 1121
Note: See TracChangeset
for help on using the changeset viewer.