You appear to be a bot. Output may be restricted
Description
Usage
Tests_Admin_Includes_Post::test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_link_when_changing_slug();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/admin/includesPost.php
Lines:
1 to 54 of 54
public function test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_link_when_changing_slug() { $this->set_permalink_structure( '/%postname%/' ); wp_set_current_user( self::$admin_id ); // Published posts should use published permalink $p = self::factory()->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo-صورة', ) ); $found = get_sample_permalink_html( $p, null, 'new_slug-صورة' ); $post = get_post( $p ); $message = 'Published post'; $this->assertContains( 'href="' . get_option( 'home' ) . '/' . $post->post_name . '/"', $found, $message ); $this->assertContains( '>new_slug-صورة<', $found, $message ); // Scheduled posts should use published permalink $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 ); $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'bar-صورة', 'post_date' => $future_date, ) ); $found = get_sample_permalink_html( $p, null, 'new_slug-صورة' ); $post = get_post( $p ); $message = 'Scheduled post'; $this->assertContains( 'href="' . get_option( 'home' ) . '/' . $post->post_name . '/"', $found, $message ); $this->assertContains( '>new_slug-صورة<', $found, $message ); // Draft posts should use preview link $p = self::factory()->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz-صورة', ) ); $found = get_sample_permalink_html( $p, null, 'new_slug-صورة' ); $post = get_post( $p ); $message = 'Draft post'; $preview_link = get_permalink( $post->ID ); $preview_link = add_query_arg( 'preview', 'true', $preview_link ); $this->assertContains( 'href="' . esc_url( $preview_link ) . '"', $found, $message ); $this->assertContains( '>new_slug-صورة<', $found, $message ); }