Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

covers f #5381

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/phpunit/tests/feed/atom.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* and contains the right stuff.
*
* @group feed
*
* @covers ::xml_find
*/
class Tests_Feed_Atom extends WP_UnitTestCase {
public static $user_id;
Expand Down
43 changes: 37 additions & 6 deletions tests/phpunit/tests/feed/rss2.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ private function do_rss2() {
/**
* Test the <rss> element to make sure its present and populated
* with the expected child elements and attributes.
*
* @covers ::xml_find
*/
public function test_rss_element() {
$this->go_to( '/?feed=rss2' );
Expand All @@ -133,6 +135,8 @@ public function test_rss_element() {
/**
* [test_channel_element description]
*
* @covers ::xml_find
*
* @return [type] [description]
*/
public function test_channel_element() {
Expand Down Expand Up @@ -164,6 +168,8 @@ public function test_channel_element() {
* Test that translated feeds have a valid listed date.
*
* @ticket 39141
*
* @covers ::xml_find
*/
public function test_channel_pubdate_element_translated() {
$original_locale = $GLOBALS['wp_locale'];
Expand All @@ -188,6 +194,9 @@ public function test_channel_pubdate_element_translated() {
$this->assertStringNotContainsString( 'Tue_Translated', $pubdate[0]['content'] );
}

/**
* @covers ::xml_find
*/
public function test_item_elements() {
$this->go_to( '/?feed=rss2' );
$feed = $this->do_rss2();
Expand Down Expand Up @@ -278,6 +287,8 @@ public function test_item_elements() {

/**
* @ticket 9134
*
* @covers ::xml_find
*/
public function test_items_comments_closed() {
add_filter( 'comments_open', '__return_false' );
Expand Down Expand Up @@ -308,11 +319,14 @@ public function test_items_comments_closed() {
remove_filter( 'comments_open', '__return_false' );
}

/*
/**
* Check to make sure we are rendering feed templates for the home feed.
* e.g. https://example.com/feed/
*
* @ticket 30210
*
* @covers ::xml_find
* @covers ::have_posts
*/
public function test_valid_home_feed_endpoint() {
// An example of a valid home feed endpoint.
Expand All @@ -336,11 +350,14 @@ public function test_valid_home_feed_endpoint() {
$this->assertCount( 1, $rss );
}

/*
/**
* Check to make sure we are rendering feed templates for the taxonomy feeds.
* e.g. https://example.com/category/foo/feed/
*
* @ticket 30210
*
* @covers ::xml_find
* @covers ::have_posts
*/
public function test_valid_taxonomy_feed_endpoint() {
// An example of an valid taxonomy feed endpoint.
Expand All @@ -364,11 +381,14 @@ public function test_valid_taxonomy_feed_endpoint() {
$this->assertCount( 1, $rss );
}

/*
/**
* Check to make sure we are rendering feed templates for the main comment feed.
* e.g. https://example.com/comments/feed/
*
* @ticket 30210
*
* @covers ::xml_find
* @covers ::have_comments
*/
public function test_valid_main_comment_feed_endpoint() {
// Generate a bunch of comments.
Expand Down Expand Up @@ -397,11 +417,14 @@ public function test_valid_main_comment_feed_endpoint() {
$this->assertCount( 1, $rss );
}

/*
/**
* Check to make sure we are rendering feed templates for the date archive feeds.
* e.g. https://example.com/2003/05/27/feed/
*
* @ticket 30210
*
* @covers ::xml_find
* @covers ::have_comments
*/
public function test_valid_archive_feed_endpoint() {
// An example of an valid date archive feed endpoint.
Expand All @@ -425,11 +448,14 @@ public function test_valid_archive_feed_endpoint() {
$this->assertCount( 1, $rss );
}

/*
/**
* Check to make sure we are rendering feed templates for single post comment feeds.
* e.g. https://example.com/2003/05/27/post-name/feed/
*
* @ticket 30210
*
* @covers ::xml_find
* @covers ::have_comments
*/
public function test_valid_single_post_comment_feed_endpoint() {
// An example of an valid date archive feed endpoint.
Expand All @@ -453,11 +479,14 @@ public function test_valid_single_post_comment_feed_endpoint() {
$this->assertCount( 1, $rss );
}

/*
/**
* Check to make sure we are rendering feed templates for the search archive feeds.
* e.g. https://example.com/?s=Lorem&feed=rss
*
* @ticket 30210
*
* @covers ::xml_find
* @covers ::have_comments
*/
public function test_valid_search_feed_endpoint() {
// An example of an valid search feed endpoint.
Expand Down Expand Up @@ -487,6 +516,8 @@ public function test_valid_search_feed_endpoint() {
* @ticket 4575
*
* @dataProvider data_get_feed_build_date
*
* @covers ::xml_find
*/
public function test_get_feed_build_date( $url, $element ) {
$this->go_to( $url );
Expand Down
30 changes: 30 additions & 0 deletions tests/phpunit/tests/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public function set_up() {
/**
* @group plugins
* @group themes
*
* @covers ::get_file_data
*/
public function test_get_file_data() {
$theme_headers = array(
Expand Down Expand Up @@ -49,6 +51,8 @@ public function test_get_file_data() {
* @ticket 19854
* @group plugins
* @group themes
*
* @covers ::get_file_data
*/
public function test_get_file_data_with_cr_line_endings() {
$headers = array(
Expand All @@ -73,6 +77,8 @@ public function test_get_file_data_with_cr_line_endings() {
* @ticket 47186
* @group plugins
* @group themes
*
* @covers ::get_file_data
*/
public function test_get_file_data_with_php_open_tag_prefix() {
$headers = array(
Expand Down Expand Up @@ -112,6 +118,9 @@ private function is_unique_writable_file( $path, $filename ) {
return $result;
}

/**
* @covers ::wp_unique_filename
*/
public function test_unique_filename_is_valid() {
// Make sure it produces a valid, writable, unique filename.
$filename = wp_unique_filename( $this->dir, __FUNCTION__ . '.txt' );
Expand All @@ -121,6 +130,9 @@ public function test_unique_filename_is_valid() {
unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
}

/**
* @covers ::wp_unique_filename
*/
public function test_unique_filename_is_unique() {
// Make sure it produces two unique filenames.
$name = __FUNCTION__;
Expand All @@ -137,6 +149,9 @@ public function test_unique_filename_is_unique() {
unlink( $this->dir . DIRECTORY_SEPARATOR . $filename2 );
}

/**
* @covers ::wp_unique_filename
*/
public function test_unique_filename_is_sanitized() {
$name = __FUNCTION__;
$filename = wp_unique_filename( $this->dir, $name . self::BADCHARS . '.txt' );
Expand All @@ -149,6 +164,9 @@ public function test_unique_filename_is_sanitized() {
unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
}

/**
* @covers ::wp_unique_filename
*/
public function test_unique_filename_with_slashes() {
$name = __FUNCTION__;
// "foo/foo.txt"
Expand All @@ -162,6 +180,9 @@ public function test_unique_filename_with_slashes() {
unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
}

/**
* @covers ::wp_unique_filename
*/
public function test_unique_filename_multiple_ext() {
$name = __FUNCTION__;
$filename = wp_unique_filename( $this->dir, $name . '.php.txt' );
Expand All @@ -174,6 +195,9 @@ public function test_unique_filename_multiple_ext() {
unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
}

/**
* @covers ::wp_unique_filename
*/
public function test_unique_filename_no_ext() {
$name = __FUNCTION__;
$filename = wp_unique_filename( $this->dir, $name );
Expand All @@ -187,6 +211,8 @@ public function test_unique_filename_no_ext() {

/**
* @dataProvider data_wp_tempnam_filenames
*
* @covers ::wp_tempnam
*/
public function test_wp_tempnam( $filename ) {
$file = wp_tempnam( $filename );
Expand Down Expand Up @@ -400,6 +426,8 @@ static function ( $filename ) use ( &$filenames_over_limit ) {

/**
* @ticket 47186
*
* @covers ::verify_file_signature
*/
public function test_file_signature_functions_as_expected() {
$file = wp_tempnam();
Expand Down Expand Up @@ -433,6 +461,8 @@ public function test_file_signature_functions_as_expected() {

/**
* @ticket 47186
*
* @covers ::verify_file_signature
*/
public function test_file_signature_expected_failure() {
$file = wp_tempnam();
Expand Down
6 changes: 6 additions & 0 deletions tests/phpunit/tests/filesystem/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public function filter_abstraction_file( $file ) {
return dirname( __DIR__, 2 ) . '/includes/mock-fs.php';
}

/**
* This test method covers a mock class. Mock classes are not supposed
* to be added to the coverage report.
*
* @coversNothing
*/
public function test_is_MockFS_sane() {
global $wp_filesystem;
$this->assertInstanceOf( 'WP_Filesystem_MockFS', $wp_filesystem );
Expand Down
2 changes: 2 additions & 0 deletions tests/phpunit/tests/filesystem/findFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/**
* @group file
* @group filesystem
*
* @coversNothing
*/
class WP_Filesystem_Find_Folder_Test extends WP_Filesystem_UnitTestCase {

Expand Down
Loading
Loading