Changeset 42828 for trunk/tests/phpunit/tests/link/getAdjacentPost.php
- Timestamp:
- 03/11/2018 05:31:04 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/getAdjacentPost.php
r42343 r42828 247 247 * @ticket 35211 248 248 */ 249 public function test_ excluded_terms_filter() {249 public function test_get_adjacent_post_excluded_terms_filter() { 250 250 register_taxonomy( 'wptests_tax', 'post' ); 251 251 … … 277 277 } 278 278 279 /** 280 * @ticket 43521 281 */ 282 public function test_get_adjacent_post_excluded_terms_filter_should_apply_to_empty_excluded_terms_parameter() { 283 register_taxonomy( 'wptests_tax', 'post' ); 284 285 $terms = self::factory()->term->create_many( 286 2, array( 287 'taxonomy' => 'wptests_tax', 288 ) 289 ); 290 291 $p1 = self::factory()->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) ); 292 $p2 = self::factory()->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) ); 293 $p3 = self::factory()->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) ); 294 295 wp_set_post_terms( $p1, array( $terms[0], $terms[1] ), 'wptests_tax' ); 296 wp_set_post_terms( $p2, array( $terms[1] ), 'wptests_tax' ); 297 wp_set_post_terms( $p3, array( $terms[0] ), 'wptests_tax' ); 298 299 $this->go_to( get_permalink( $p1 ) ); 300 301 $this->exclude_term = $terms[1]; 302 add_filter( 'get_previous_post_excluded_terms', array( $this, 'filter_excluded_terms' ) ); 303 304 $found = get_adjacent_post( false, array(), true, 'wptests_tax' ); 305 306 remove_filter( 'get_previous_post_excluded_terms', array( $this, 'filter_excluded_terms' ) ); 307 unset( $this->exclude_term ); 308 309 $this->assertSame( $p3, $found->ID ); 310 } 311 279 312 public function filter_excluded_terms( $excluded_terms ) { 280 313 $excluded_terms[] = $this->exclude_term;
Note: See TracChangeset
for help on using the changeset viewer.