Changeset 48937 for trunk/tests/phpunit/tests/link.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link.php
r47122 r48937 22 22 23 23 remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) ); 24 $this->assert Equals( $paged, home_url( '/WooHoo/page/2/' ) );24 $this->assertSame( $paged, home_url( '/WooHoo/page/2/' ) ); 25 25 26 26 $_SERVER['REQUEST_URI'] = $old_req_uri; … … 32 32 33 33 // Basic case. 34 $this->assert Equals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );34 $this->assertSame( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 35 35 36 36 unset( $GLOBALS['post'] ); 37 37 38 38 // Global post is not set. 39 $this->assert Equals( '', wp_get_shortlink( 0, 'post' ) );40 $this->assert Equals( '', wp_get_shortlink( 0 ) );41 $this->assert Equals( '', wp_get_shortlink() );39 $this->assertSame( '', wp_get_shortlink( 0, 'post' ) ); 40 $this->assertSame( '', wp_get_shortlink( 0 ) ); 41 $this->assertSame( '', wp_get_shortlink() ); 42 42 43 43 $GLOBALS['post'] = get_post( $post_id ); 44 44 45 45 // Global post is set. 46 $this->assert Equals( get_permalink( $post_id ), wp_get_shortlink( 0, 'post' ) );47 $this->assert Equals( get_permalink( $post_id ), wp_get_shortlink( 0 ) );48 $this->assert Equals( get_permalink( $post_id ), wp_get_shortlink() );46 $this->assertSame( get_permalink( $post_id ), wp_get_shortlink( 0, 'post' ) ); 47 $this->assertSame( get_permalink( $post_id ), wp_get_shortlink( 0 ) ); 48 $this->assertSame( get_permalink( $post_id ), wp_get_shortlink() ); 49 49 50 50 // Not the global post. 51 $this->assert Equals( get_permalink( $post_id2 ), wp_get_shortlink( $post_id2, 'post' ) );51 $this->assertSame( get_permalink( $post_id2 ), wp_get_shortlink( $post_id2, 'post' ) ); 52 52 53 53 unset( $GLOBALS['post'] ); 54 54 55 55 // Global post is not set, once again. 56 $this->assert Equals( '', wp_get_shortlink( 0, 'post' ) );57 $this->assert Equals( '', wp_get_shortlink( 0 ) );58 $this->assert Equals( '', wp_get_shortlink() );56 $this->assertSame( '', wp_get_shortlink( 0, 'post' ) ); 57 $this->assertSame( '', wp_get_shortlink( 0 ) ); 58 $this->assertSame( '', wp_get_shortlink() ); 59 59 60 60 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); … … 62 62 // With a permalink structure set, get_permalink() will no longer match. 63 63 $this->assertNotEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 64 $this->assert Equals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );64 $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 65 65 66 66 // Global post and permalink structure are set. 67 67 $GLOBALS['post'] = get_post( $post_id ); 68 $this->assert Equals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) );69 $this->assert Equals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );70 $this->assert Equals( home_url( '?p=' . $post_id ), wp_get_shortlink() );68 $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) ); 69 $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) ); 70 $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink() ); 71 71 } 72 72 … … 76 76 // Basic case. 77 77 // Don't test against get_permalink() since it uses ?page_id= for pages. 78 $this->assert Equals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );79 80 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 81 82 $this->assert Equals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );78 $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 79 80 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 81 82 $this->assertSame( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) ); 83 83 } 84 84 … … 91 91 update_option( 'page_on_front', $post_id ); 92 92 93 $this->assert Equals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );94 95 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 96 97 $this->assert Equals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );93 $this->assertSame( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) ); 94 95 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 96 97 $this->assertSame( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) ); 98 98 } 99 99 … … 115 115 $non_pretty_permalink = add_query_arg( 'p', $p, trailingslashit( home_url() ) ); 116 116 117 $this->assert Equals( $non_pretty_permalink, get_permalink( $p ) );117 $this->assertSame( $non_pretty_permalink, get_permalink( $p ) ); 118 118 } 119 119 … … 144 144 ); 145 145 146 $this->assert Equals( $non_pretty_permalink, get_permalink( $p ) );146 $this->assertSame( $non_pretty_permalink, get_permalink( $p ) ); 147 147 } 148 148
Note: See TracChangeset
for help on using the changeset viewer.