Skip to content

Commit d20a2fb

Browse files
committed
Tests: Load the menu quick search helper in test setup.
Load `nav-menu.php` before each test so the searches can run independently. Developed in: #16130 Props ekamran. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65728 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 860be52 commit d20a2fb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎tests/phpunit/tests/menu/wpAjaxMenuQuickSearch.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55
*/
66
class Tests_Menu_WpAjaxMenuQuickSearch extends WP_UnitTestCase {
77

8+
public function set_up() {
9+
parent::set_up();
10+
11+
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
12+
}
13+
814
/**
915
* Test search returns results for pages.
1016
*
1117
* @ticket 27042
1218
*/
1319
public function test_search_returns_results_for_pages() {
14-
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
15-
1620
self::factory()->post->create_many(
1721
3,
1822
array(
@@ -48,8 +52,6 @@ public function test_search_returns_results_for_pages() {
4852
* @ticket 48655
4953
*/
5054
public function test_search_only_returns_results_for_posts_with_term_in_title() {
51-
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
52-
5355
// This will make sure that WP_Query sets is_admin to true.
5456
set_current_screen( 'nav-menu.php' );
5557

@@ -87,8 +89,6 @@ public function test_search_only_returns_results_for_posts_with_term_in_title()
8789
* @ticket 33742
8890
*/
8991
public function test_search_returns_results_for_published_posts() {
90-
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
91-
9292
// This will make sure that WP_Query sets is_admin to true.
9393
set_current_screen( 'nav-menu.php' );
9494

0 commit comments

Comments
 (0)