@@ -303,6 +303,8 @@ public function data_provider_test_od_get_current_url_metrics_etag(): array {
303
303
$ GLOBALS ['template ' ] = trailingslashit ( get_template_directory () ) . 'home.php ' ;
304
304
305
305
return function ( array $ etag_data , Closure $ get_etag ) use ( $ post ): void {
306
+ $ this ->assertTrue ( is_home () );
307
+ $ this ->assertTrue ( is_front_page () );
306
308
$ this ->assertNull ( $ etag_data ['queried_object ' ]['id ' ] );
307
309
$ this ->assertNull ( $ etag_data ['queried_object ' ]['type ' ] );
308
310
$ this ->assertCount ( 1 , $ etag_data ['queried_posts ' ] );
@@ -340,6 +342,7 @@ static function ( $data ) {
340
342
$ GLOBALS ['template ' ] = trailingslashit ( get_template_directory () ) . 'single.php ' ;
341
343
342
344
return function ( array $ etag_data , Closure $ get_etag ) use ( $ post ): void {
345
+ $ this ->assertTrue ( is_single ( $ post ) );
343
346
$ this ->assertSame ( $ post ->ID , $ etag_data ['queried_object ' ]['id ' ] );
344
347
$ this ->assertSame ( 'post ' , $ etag_data ['queried_object ' ]['type ' ] );
345
348
$ this ->assertArrayHasKey ( 'post_modified_gmt ' , $ etag_data ['queried_object ' ] );
@@ -378,6 +381,7 @@ static function ( $data ) {
378
381
$ GLOBALS ['template ' ] = trailingslashit ( get_template_directory () ) . 'category.php ' ;
379
382
380
383
return function ( array $ etag_data ) use ( $ term , $ post_ids ): void {
384
+ $ this ->assertTrue ( is_category ( $ term ) );
381
385
$ this ->assertSame ( $ term ->term_id , $ etag_data ['queried_object ' ]['id ' ] );
382
386
$ this ->assertSame ( 'term ' , $ etag_data ['queried_object ' ]['type ' ] );
383
387
$ this ->assertCount ( 2 , $ etag_data ['queried_posts ' ] );
@@ -396,6 +400,7 @@ static function ( $data ) {
396
400
$ GLOBALS ['template ' ] = trailingslashit ( get_template_directory () ) . 'author.php ' ;
397
401
398
402
return function ( array $ etag_data ) use ( $ user_id , $ post_ids ): void {
403
+ $ this ->assertTrue ( is_author ( $ user_id ), 'Expected is_author() after having gone to ' . get_author_posts_url ( $ user_id ) );
399
404
$ this ->assertSame ( $ user_id , $ etag_data ['queried_object ' ]['id ' ] );
400
405
$ this ->assertSame ( 'user ' , $ etag_data ['queried_object ' ]['type ' ] );
401
406
$ this ->assertCount ( 3 , $ etag_data ['queried_posts ' ] );
@@ -419,6 +424,7 @@ static function ( $data ) {
419
424
$ GLOBALS ['template ' ] = trailingslashit ( get_template_directory () ) . 'archive-book.php ' ;
420
425
421
426
return function ( array $ etag_data ) use ( $ post_ids ): void {
427
+ $ this ->assertTrue ( is_post_type_archive ( 'book ' ) );
422
428
$ this ->assertNull ( $ etag_data ['queried_object ' ]['id ' ] );
423
429
$ this ->assertSame ( 'book ' , $ etag_data ['queried_object ' ]['type ' ] );
424
430
$ this ->assertCount ( 4 , $ etag_data ['queried_posts ' ] );
@@ -439,6 +445,8 @@ static function ( $data ) {
439
445
$ GLOBALS ['template ' ] = trailingslashit ( get_template_directory () ) . 'home.php ' ;
440
446
441
447
return function ( array $ etag_data ) use ( $ page_id , $ post_ids ): void {
448
+ $ this ->assertTrue ( is_home () );
449
+ $ this ->assertFalse ( is_front_page () );
442
450
$ this ->assertSame ( $ page_id , $ etag_data ['queried_object ' ]['id ' ] );
443
451
$ this ->assertSame ( 'post ' , $ etag_data ['queried_object ' ]['type ' ] );
444
452
$ this ->assertCount ( 5 , $ etag_data ['queried_posts ' ] );
@@ -455,6 +463,8 @@ static function ( $data ) {
455
463
update_option ( 'template ' , 'block-theme ' );
456
464
update_option ( 'stylesheet ' , 'block-theme ' );
457
465
$ this ->go_to ( '/ ' );
466
+ $ this ->assertTrue ( is_home () );
467
+ $ this ->assertTrue ( is_front_page () );
458
468
$ GLOBALS ['_wp_current_template_id ' ] = 'block-theme//index ' ;
459
469
460
470
return function ( array $ etag_data ): void {
0 commit comments