Changeset 47122 for trunk/tests/phpunit/tests/link.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link.php
r46586 r47122 31 31 $post_id2 = self::factory()->post->create(); 32 32 33 // Basic case 33 // Basic case. 34 34 $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 35 35 36 36 unset( $GLOBALS['post'] ); 37 37 38 // Global post is not set 38 // Global post is not set. 39 39 $this->assertEquals( '', wp_get_shortlink( 0, 'post' ) ); 40 40 $this->assertEquals( '', wp_get_shortlink( 0 ) ); … … 43 43 $GLOBALS['post'] = get_post( $post_id ); 44 44 45 // Global post is set 45 // Global post is set. 46 46 $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0, 'post' ) ); 47 47 $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0 ) ); 48 48 $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink() ); 49 49 50 // Not the global post 50 // Not the global post. 51 51 $this->assertEquals( get_permalink( $post_id2 ), wp_get_shortlink( $post_id2, 'post' ) ); 52 52 53 53 unset( $GLOBALS['post'] ); 54 54 55 // Global post is not set, once again 55 // Global post is not set, once again. 56 56 $this->assertEquals( '', wp_get_shortlink( 0, 'post' ) ); 57 57 $this->assertEquals( '', wp_get_shortlink( 0 ) ); … … 64 64 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 65 65 66 // Global post and permalink structure are set 66 // Global post and permalink structure are set. 67 67 $GLOBALS['post'] = get_post( $post_id ); 68 68 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) ); … … 74 74 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 75 75 76 // Basic case 76 // Basic case. 77 77 // Don't test against get_permalink() since it uses ?page_id= for pages. 78 78 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
Note: See TracChangeset
for help on using the changeset viewer.