Changeset 33773 for trunk/tests/phpunit/tests/admin/includesPost.php
- Timestamp:
- 08/27/2015 08:56:54 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/admin/includesPost.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPost.php
r32647 r33773 316 316 317 317 /** 318 * @ticket 32954 319 */ 320 public function test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_button_when_changing_slug() { 321 global $wp_rewrite; 322 $old_permalink_structure = get_option( 'permalink_structure' ); 323 $permalink_structure = '%postname%'; 324 $wp_rewrite->set_permalink_structure( "/$permalink_structure/" ); 325 flush_rewrite_rules(); 326 327 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 328 329 // Published posts should use published permalink 330 $p = $this->factory->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo' ) ); 331 332 $found = get_sample_permalink_html( $p, null, 'new_slug' ); 333 $post = get_post( $p ); 334 $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/" . $post->post_name . "/'", $found ); 335 336 // Scheduled posts should use published permalink 337 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 338 $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'bar', 'post_date' => $future_date ) ); 339 340 $found = get_sample_permalink_html( $p, null, 'new_slug' ); 341 $post = get_post( $p ); 342 $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/" . $post->post_name . "/'", $found ); 343 344 // Draft posts should use preview link 345 $p = $this->factory->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz' ) ); 346 347 $found = get_sample_permalink_html( $p, null, 'new_slug' ); 348 $post = get_post( $p ); 349 350 $preview_link = get_permalink( $post->ID ); 351 $preview_link = add_query_arg( 'preview', 'true', $preview_link ); 352 353 $this->assertContains( "span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "'", $found ); 354 355 $wp_rewrite->set_permalink_structure( $old_permalink_structure ); 356 flush_rewrite_rules(); 357 } 358 359 /** 318 360 * @ticket 5305 319 361 */
Note: See TracChangeset
for help on using the changeset viewer.