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
This commit is contained in:
Sergey Biryukov
2022-10-28 14:08:20 +00:00
parent 8550fb6a5e
commit 66da481c14
4 changed files with 36 additions and 11 deletions

View File

@@ -2,8 +2,11 @@
/**
* @group wp
*
* @covers WP::add_query_var
*/
class Tests_WP extends WP_UnitTestCase {
class Tests_WP_AddQueryVar extends WP_UnitTestCase {
/**
* @var WP
*/
@@ -25,14 +28,4 @@ class Tests_WP extends WP_UnitTestCase {
$this->assertContains( 'test', $this->wp->public_query_vars );
$this->assertContains( 'test2', $this->wp->public_query_vars );
}
public function test_remove_query_var() {
$public_qv_count = count( $this->wp->public_query_vars );
$this->wp->add_query_var( 'test' );
$this->assertContains( 'test', $this->wp->public_query_vars );
$this->wp->remove_query_var( 'test' );
$this->assertCount( $public_qv_count, $this->wp->public_query_vars );
}
}

View File

@@ -2,9 +2,11 @@
/**
* @group wp
*
* @covers WP::parse_request
*/
class Tests_WP_ParseRequest extends WP_UnitTestCase {
/**
* @var WP
*/

View File

@@ -0,0 +1,29 @@
<?php
/**
* @group wp
*
* @covers WP::remove_query_var
*/
class Tests_WP_RemoveQueryVar extends WP_UnitTestCase {
/**
* @var WP
*/
protected $wp;
public function set_up() {
parent::set_up();
$this->wp = new WP();
}
public function test_remove_query_var() {
$public_qv_count = count( $this->wp->public_query_vars );
$this->wp->add_query_var( 'test' );
$this->assertContains( 'test', $this->wp->public_query_vars );
$this->wp->remove_query_var( 'test' );
$this->assertCount( $public_qv_count, $this->wp->public_query_vars );
}
}

View File

@@ -2,6 +2,7 @@
/**
* @group wp
*
* @covers WP::send_headers
*/
class Tests_WP_SendHeaders extends WP_UnitTestCase {