Changeset 32002 for trunk/tests/phpunit/tests/admin/includesPost.php
- Timestamp:
- 04/04/2015 01:26:08 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPost.php
r31392 r32002 270 270 flush_rewrite_rules(); 271 271 } 272 273 /** 274 * @ticket 30910 275 */ 276 public function test_get_sample_permalink_html_should_use_default_permalink_for_view_post_button_when_pretty_permalinks_are_disabled() { 277 global $wp_rewrite; 278 $old_permalink_structure = get_option( 'permalink_structure' ); 279 $wp_rewrite->set_permalink_structure( '' ); 280 flush_rewrite_rules(); 281 282 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 283 284 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 285 $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) ); 286 287 $found = get_sample_permalink_html( $p ); 288 $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/?p=$p'", $found ); 289 290 $wp_rewrite->set_permalink_structure( $old_permalink_structure ); 291 flush_rewrite_rules(); 292 } 293 294 /** 295 * @ticket 30910 296 */ 297 public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_post_button_when_pretty_permalinks_are_enabled() { 298 global $wp_rewrite; 299 $old_permalink_structure = get_option( 'permalink_structure' ); 300 $permalink_structure = '%postname%'; 301 $wp_rewrite->set_permalink_structure( "/$permalink_structure/" ); 302 flush_rewrite_rules(); 303 304 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 305 306 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 307 $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) ); 308 309 $found = get_sample_permalink_html( $p ); 310 $post = get_post( $p ); 311 $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/" . $post->post_name . "/'", $found ); 312 313 $wp_rewrite->set_permalink_structure( $old_permalink_structure ); 314 flush_rewrite_rules(); 315 } 272 316 }
Note: See TracChangeset
for help on using the changeset viewer.