mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
`the_post()` sets the `$in_the_loop` property to true which is unexpected in the admin if you're using filters which should only affect real loops. Props ruud@joyo. Fixes #27042. git-svn-id: https://develop.svn.wordpress.org/trunk@37881 602fd350-edb4-49c9-b593-d223f7449a82
30 lines
777 B
PHP
30 lines
777 B
PHP
<?php
|
|
|
|
/**
|
|
* @group menu
|
|
*/
|
|
class Tests_Menu_WpAjaxMenuQuickSeach extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* @ticket 27042
|
|
*/
|
|
public function test_search_returns_results_for_pages() {
|
|
include_once ABSPATH . 'wp-admin/includes/nav-menu.php';
|
|
|
|
self::factory()->post->create_many( 3, array( 'post_type' => 'page', 'post_content' => 'foo' ) );
|
|
self::factory()->post->create( array( 'post_type' => 'page', 'post_content' => 'bar' ) );
|
|
|
|
$request = array(
|
|
'type' => 'quick-search-posttype-page',
|
|
'q' => 'foo',
|
|
'response-format' => 'json',
|
|
);
|
|
|
|
$output = get_echo( '_wp_ajax_menu_quick_search', array( $request ) );
|
|
$this->assertNotEmpty( $output );
|
|
|
|
$results = explode( "\n", trim( $output ) );
|
|
$this->assertCount( 3, $results );
|
|
}
|
|
}
|