Changeset 31323
- Timestamp:
- 02/02/2015 04:49:23 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r31292 r31323 1153 1153 1154 1154 // Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published. 1155 if ( in_array( $post->post_status, array( 'draft', 'pending' ) ) ) {1155 if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) ) { 1156 1156 $post->post_status = 'publish'; 1157 1157 $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID); -
trunk/tests/phpunit/tests/admin/includesPost.php
r28113 r31323 179 179 } 180 180 181 /** 182 * @ticket 30910 183 */ 184 public function test_get_sample_permalink_should_return_pretty_permalink_for_posts_with_post_status_future() { 185 global $wp_rewrite; 186 187 $old_permalink_structure = get_option( 'permalink_structure' ); 188 $permalink_structure = '%postname%'; 189 $wp_rewrite->set_permalink_structure( "/$permalink_structure/" ); 190 flush_rewrite_rules(); 191 192 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 193 $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) ); 194 195 $found = get_sample_permalink( $p ); 196 $expected = trailingslashit( home_url( $permalink_structure ) ); 197 198 $this->assertSame( $expected, $found[0] ); 199 200 $wp_rewrite->set_permalink_structure( $old_permalink_structure ); 201 flush_rewrite_rules(); 202 } 181 203 }
Note: See TracChangeset
for help on using the changeset viewer.