wordpress-develop/tests/phpunit/tests/wp/sendHeaders.php
Sergey Biryukov 66da481c14 Tests: Move the tests for WP class methods to the wp directory.
This aims to bring some consistency to the location of the tests for this class.

Includes adding the missing `@covers` tags.

Follow-up to [36177], [51622], [54250].

Props pbearne, SergeyBiryukov.
See #56793, #56782.

git-svn-id: https://develop.svn.wordpress.org/trunk@54710 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-28 14:08:20 +00:00

39 lines
711 B
PHP

<?php
/**
* @group wp
*
* @covers WP::send_headers
*/
class Tests_WP_SendHeaders extends WP_UnitTestCase {
/**
* @ticket 56068
*/
public function test_send_headers_runs_after_posts_have_been_queried() {
add_action(
'send_headers',
function ( $wp ) {
$this->assertQueryTrue( 'is_front_page', 'is_home' );
}
);
$this->go_to( home_url() );
}
/**
* @ticket 56840
*/
public function test_send_headers_sets_x_pingback_for_single_posts_that_allow_pings() {
add_action(
'wp_headers',
function ( $headers ) {
$this->assertArrayHasKey( 'X-Pingback', $headers );
}
);
$post_id = self::factory()->post->create();
$this->go_to( get_permalink( $post_id ) );
}
}