| 301 | |
| 302 | public function test_post_permalink_not_rewritten_on_future_post() { |
| 303 | update_option('permalink_structure','/%year%/%monthnum%/%day%/%postname%/'); |
| 304 | $post = array( |
| 305 | 'post_author' => self::$author_user, |
| 306 | 'post_status' => 'publish', |
| 307 | 'post_content' => rand_str(), |
| 308 | 'post_title' => 'Future Test Post', |
| 309 | 'post_date' => strftime("%Y-%m-%d %H:%M:%S", strtotime('+1 day')) |
| 310 | ); |
| 311 | |
| 312 | $post['ID'] = $this->factory->post->create($post); |
| 313 | |
| 314 | $future_permalink = get_permalink($post['ID']); |
| 315 | |
| 316 | $post['post_date'] = strftime("%Y-%m-%d %H:%M:%S", strtotime('-1 day')); |
| 317 | |
| 318 | wp_publish_post($post['ID']); |
| 319 | |
| 320 | $publish_permalink = get_permalink($post['ID']); |
| 321 | |
| 322 | $this->assertNotEquals($future_permalink, $publish_permalink); |
| 323 | return; |
| 324 | } |
| 325 | |
| 326 | |
| 327 | public function test_custom_post_type_permalink_not_rewritten_on_future_post() { |
| 328 | update_option('permalink_structure','/%year%/%monthnum%/%day%/%postname%/'); |
| 329 | $post = array( |
| 330 | 'post_author' => self::$author_user, |
| 331 | 'post_status' => 'publish', |
| 332 | 'post_content' => rand_str(), |
| 333 | 'post_title' => 'Future Test Post', |
| 334 | 'post_date' => strftime("%Y-%m-%d %H:%M:%S", strtotime('+1 day')) |
| 335 | ); |
| 336 | |
| 337 | $post['ID'] = $this->factory->post->create($post); |
| 338 | |
| 339 | $future_permalink = get_permalink($post['ID']); |
| 340 | |
| 341 | $post['post_date'] = strftime("%Y-%m-%d %H:%M:%S", strtotime('-1 day')); |
| 342 | |
| 343 | wp_publish_post($post['ID']); |
| 344 | |
| 345 | $publish_permalink = get_post_permalink($post['ID']); |
| 346 | |
| 347 | $this->assertNotEquals($future_permalink, $publish_permalink); |
| 348 | return; |
| 349 | } |