Changeset 38792 for trunk/tests/phpunit/tests/query/search.php
- Timestamp:
- 10/14/2016 08:05:40 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/search.php
r38733 r38792 58 58 function filter_wp_search_stopwords() { 59 59 return array(); 60 } 61 62 /** 63 * @ticket 38099 64 */ 65 function test_filter_wp_query_use_hyphen_for_exclusion() { 66 $title = '-HYPHENATION_TEST'; 67 68 // Create a post with a title which starts with a hyphen 69 $post_id = self::factory()->post->create( array( 70 'post_content' => $title, 'post_type' => $this->post_type 71 ) ); 72 73 // By default, we can use the hyphen prefix to exclude results 74 $this->assertEquals( array(), $this->get_search_results( $title ) ); 75 76 // After we disable the feature using the filter, we should get the result 77 add_filter( 'wp_query_use_hyphen_for_exclusion', '__return_false' ); 78 $result = $this->get_search_results( $title ); 79 $post = array_pop( $result ); 80 $this->assertEquals( $post->ID, $post_id ); 81 remove_filter( 'wp_query_use_hyphen_for_exclusion', '__return_false' ); 60 82 } 61 83
Note: See TracChangeset
for help on using the changeset viewer.