Changeset 54047 for trunk/tests/phpunit/tests/site-health.php
- Timestamp:
- 09/01/2022 03:26:29 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/site-health.php
r54045 r54047 3 3 /** 4 4 * @group site-health 5 * 6 * @coversDefaultClass WP_Site_Health 5 7 */ 6 8 class Tests_Site_Health extends WP_UnitTestCase { … … 111 113 /** 112 114 * @ticket 56041 113 * @dataProvider data_ page_cache_test115 * @dataProvider data_get_page_cache 114 116 * @covers ::get_test_page_cache() 115 117 * @covers ::get_page_cache_detail() … … 203 205 204 206 /** 205 * @group ms-excluded 206 * @ticket 56040 207 */ 208 public function test_object_cache_default_thresholds() { 209 $wp_site_health = new WP_Site_Health(); 210 211 $this->assertFalse( 212 $wp_site_health->should_suggest_persistent_object_cache() 213 ); 214 } 215 216 217 /** 218 * @group ms-required 219 * @ticket 56040 220 */ 221 public function test_object_cache_default_thresholds_on_multisite() { 222 $wp_site_health = new WP_Site_Health(); 223 $this->assertTrue( 224 $wp_site_health->should_suggest_persistent_object_cache() 225 ); 226 } 227 228 /** 229 * @ticket 56040 230 */ 231 public function test_object_cache_thresholds_check_can_be_bypassed() { 232 $wp_site_health = new WP_Site_Health(); 233 add_filter( 'site_status_should_suggest_persistent_object_cache', '__return_true' ); 234 235 $this->assertTrue( 236 $wp_site_health->should_suggest_persistent_object_cache() 237 ); 238 } 239 240 /** 241 * @dataProvider thresholds 242 * @ticket 56040 243 */ 244 public function test_object_cache_thresholds( $threshold, $count ) { 245 $wp_site_health = new WP_Site_Health(); 246 add_filter( 247 'site_status_persistent_object_cache_thresholds', 248 function ( $thresholds ) use ( $threshold, $count ) { 249 return array_merge( $thresholds, array( $threshold => $count ) ); 250 } 251 ); 252 253 $this->assertTrue( 254 $wp_site_health->should_suggest_persistent_object_cache() 255 ); 256 } 257 258 /** 259 * Gets response data for get_test_page_cache(). 207 * Data provider for test_get_page_cache(). 208 * 209 * Gets response data for WP_Site_Health::get_test_page_cache(). 210 * 260 211 * @ticket 56041 261 212 * 262 213 * @return array[] 263 214 */ 264 public function data_ page_cache_test() {215 public function data_get_page_cache() { 265 216 $recommended_label = 'Page cache is not detected but the server response time is OK'; 266 217 $good_label = 'Page cache is detected and the server response time is good'; … … 409 360 410 361 /** 411 * Data provider. 412 * 362 * @group ms-excluded 413 363 * @ticket 56040 414 364 */ 415 public function thresholds() { 365 public function test_object_cache_default_thresholds() { 366 $wp_site_health = new WP_Site_Health(); 367 368 $this->assertFalse( 369 $wp_site_health->should_suggest_persistent_object_cache() 370 ); 371 } 372 373 374 /** 375 * @group ms-required 376 * @ticket 56040 377 */ 378 public function test_object_cache_default_thresholds_on_multisite() { 379 $wp_site_health = new WP_Site_Health(); 380 $this->assertTrue( 381 $wp_site_health->should_suggest_persistent_object_cache() 382 ); 383 } 384 385 /** 386 * @ticket 56040 387 */ 388 public function test_object_cache_thresholds_check_can_be_bypassed() { 389 $wp_site_health = new WP_Site_Health(); 390 add_filter( 'site_status_should_suggest_persistent_object_cache', '__return_true' ); 391 392 $this->assertTrue( 393 $wp_site_health->should_suggest_persistent_object_cache() 394 ); 395 } 396 397 /** 398 * @dataProvider data_object_cache_thresholds 399 * @ticket 56040 400 */ 401 public function test_object_cache_thresholds( $threshold, $count ) { 402 $wp_site_health = new WP_Site_Health(); 403 add_filter( 404 'site_status_persistent_object_cache_thresholds', 405 function ( $thresholds ) use ( $threshold, $count ) { 406 return array_merge( $thresholds, array( $threshold => $count ) ); 407 } 408 ); 409 410 $this->assertTrue( 411 $wp_site_health->should_suggest_persistent_object_cache() 412 ); 413 } 414 415 /** 416 * Data provider for test_object_cache_thresholds(). 417 * 418 * @ticket 56040 419 */ 420 public function data_object_cache_thresholds() { 416 421 return array( 417 422 array( 'comments_count', 0 ),
Note: See TracChangeset
for help on using the changeset viewer.