Tests: Add missing @covers tags for files in phpunit/tests/editor/.

Props patopaiar, jrf.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@50288 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2021-02-11 20:52:52 +00:00
parent c49e14bd7b
commit f184ef4b6c

View File

@ -8,26 +8,19 @@ if ( ! class_exists( '_WP_Editors', false ) ) {
* @group editor
*/
class Tests_WP_Editors extends WP_UnitTestCase {
public function wp_link_query_callback( $results ) {
return array_merge(
$results,
array(
array(
'ID' => 123,
'title' => 'foo',
'permalink' => 'bar',
'info' => 'baz',
),
)
);
}
/**
* @covers _WP_Editors::wp_link_query
*/
public function test_wp_link_query_returns_false_when_nothing_found() {
$actual = _WP_Editors::wp_link_query( array( 's' => 'foobarbaz' ) );
$this->assertFalse( $actual );
}
/**
* @covers _WP_Editors::wp_link_query
*/
public function test_wp_link_query_returns_search_results() {
$post = self::factory()->post->create_and_get( array( 'post_status' => 'publish' ) );
$actual = _WP_Editors::wp_link_query( array( 's' => $post->post_title ) );
@ -47,6 +40,8 @@ class Tests_WP_Editors extends WP_UnitTestCase {
/**
* @ticket 41825
*
* @covers _WP_Editors::wp_link_query
*/
public function test_wp_link_query_returns_filtered_result_when_nothing_found() {
add_filter( 'wp_link_query', array( $this, 'wp_link_query_callback' ) );
@ -66,6 +61,9 @@ class Tests_WP_Editors extends WP_UnitTestCase {
);
}
/**
* @covers _WP_Editors::wp_link_query
*/
public function test_wp_link_query_returns_filtered_search_results() {
$post = self::factory()->post->create_and_get( array( 'post_status' => 'publish' ) );
@ -91,4 +89,18 @@ class Tests_WP_Editors extends WP_UnitTestCase {
$actual
);
}
public function wp_link_query_callback( $results ) {
return array_merge(
$results,
array(
array(
'ID' => 123,
'title' => 'foo',
'permalink' => 'bar',
'info' => 'baz',
),
)
);
}
}