Changeset 48937 for trunk/tests/phpunit/tests/rewrite.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite.php
r47122 r48937 89 89 90 90 $id = self::factory()->post->create(); 91 $this->assert Equals( $id, url_to_postid( get_permalink( $id ) ) );91 $this->assertSame( $id, url_to_postid( get_permalink( $id ) ) ); 92 92 93 93 $id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 94 $this->assert Equals( $id, url_to_postid( get_permalink( $id ) ) );94 $this->assertSame( $id, url_to_postid( get_permalink( $id ) ) ); 95 95 } 96 96 … … 98 98 $post_id = self::factory()->post->create(); 99 99 $permalink = get_permalink( $post_id ); 100 $this->assert Equals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) );100 $this->assertSame( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); 101 101 102 102 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 103 103 $permalink = get_permalink( $post_id ); 104 $this->assert Equals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) );104 $this->assertSame( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); 105 105 } 106 106 … … 116 116 $page_url_to_id = url_to_postid( set_url_scheme( $page_permalink, 'http' ) ); 117 117 118 $this->assert Equals( $post_id, $post_url_to_id );119 $this->assert Equals( $page_id, $page_url_to_id );118 $this->assertSame( $post_id, $post_url_to_id ); 119 $this->assertSame( $page_id, $page_url_to_id ); 120 120 } 121 121 … … 149 149 150 150 // Test that the url_to_postid() call matched. 151 $this->assert Equals( $post_id, $url_to_postid );151 $this->assertSame( $post_id, $url_to_postid ); 152 152 } 153 153 … … 178 178 179 179 $id = self::factory()->post->create( array( 'post_type' => $post_type ) ); 180 $this->assert Equals( $id, url_to_postid( get_permalink( $id ) ) );180 $this->assertSame( $id, url_to_postid( get_permalink( $id ) ) ); 181 181 182 182 _unregister_post_type( $post_type ); … … 199 199 ); 200 200 201 $this->assert Equals( $parent_id, url_to_postid( get_permalink( $parent_id ) ) );202 $this->assert Equals( $child_id, url_to_postid( get_permalink( $child_id ) ) );201 $this->assertSame( $parent_id, url_to_postid( get_permalink( $parent_id ) ) ); 202 $this->assertSame( $child_id, url_to_postid( get_permalink( $child_id ) ) ); 203 203 } 204 204 … … 240 240 ); 241 241 242 $this->assert Equals( home_url( 'parent/child1/grandchild/' ), get_permalink( $grandchild_id_1 ) );243 $this->assert Equals( home_url( 'parent/child2/grandchild/' ), get_permalink( $grandchild_id_2 ) );244 $this->assert Equals( $grandchild_id_1, url_to_postid( get_permalink( $grandchild_id_1 ) ) );245 $this->assert Equals( $grandchild_id_2, url_to_postid( get_permalink( $grandchild_id_2 ) ) );242 $this->assertSame( home_url( 'parent/child1/grandchild/' ), get_permalink( $grandchild_id_1 ) ); 243 $this->assertSame( home_url( 'parent/child2/grandchild/' ), get_permalink( $grandchild_id_2 ) ); 244 $this->assertSame( $grandchild_id_1, url_to_postid( get_permalink( $grandchild_id_1 ) ) ); 245 $this->assertSame( $grandchild_id_2, url_to_postid( get_permalink( $grandchild_id_2 ) ) ); 246 246 } 247 247 … … 257 257 ) 258 258 ); 259 $this->assert Equals( $id, url_to_postid( get_permalink( $id ) ) );260 $this->assert Equals( $id, url_to_postid( site_url( '/example/examp' ) ) );261 $this->assert Equals( $id, url_to_postid( '/example/examp/' ) );262 $this->assert Equals( $id, url_to_postid( '/example/examp' ) );263 264 $this->assert Equals( 0, url_to_postid( site_url( '/example/ex' ) ) );265 $this->assert Equals( 0, url_to_postid( '/example/ex' ) );266 $this->assert Equals( 0, url_to_postid( '/example/ex/' ) );267 $this->assert Equals( 0, url_to_postid( '/example-page/example/' ) );268 $this->assert Equals( 0, url_to_postid( '/example-page/ex/' ) );259 $this->assertSame( $id, url_to_postid( get_permalink( $id ) ) ); 260 $this->assertSame( $id, url_to_postid( site_url( '/example/examp' ) ) ); 261 $this->assertSame( $id, url_to_postid( '/example/examp/' ) ); 262 $this->assertSame( $id, url_to_postid( '/example/examp' ) ); 263 264 $this->assertSame( 0, url_to_postid( site_url( '/example/ex' ) ) ); 265 $this->assertSame( 0, url_to_postid( '/example/ex' ) ); 266 $this->assertSame( 0, url_to_postid( '/example/ex/' ) ); 267 $this->assertSame( 0, url_to_postid( '/example-page/example/' ) ); 268 $this->assertSame( 0, url_to_postid( '/example-page/ex/' ) ); 269 269 } 270 270 … … 277 277 278 278 $this->go_to( $home_url ); 279 $this->assert Equals( array(), $GLOBALS['wp']->query_vars );279 $this->assertSame( array(), $GLOBALS['wp']->query_vars ); 280 280 281 281 $this->go_to( $home_url . 'page' ); 282 $this->assert Equals(282 $this->assertSame( 283 283 array( 284 284 'page' => '', … … 298 298 299 299 $this->go_to( $home_url ); 300 $this->assert Equals( array(), $GLOBALS['wp']->query_vars );300 $this->assertSame( array(), $GLOBALS['wp']->query_vars ); 301 301 302 302 $this->go_to( $home_url . 'page' ); 303 $this->assert Equals(303 $this->assertSame( 304 304 array( 305 305 'page' => '', … … 317 317 $GLOBALS['wp']->query_vars 318 318 ); 319 $this->assert Equals(319 $this->assertSame( 320 320 array( 321 321 'page' => '', … … 338 338 _unregister_post_type( 'foo' ); 339 339 340 $this->assert Equals( array(), $GLOBALS['wp']->query_vars );340 $this->assertSame( array(), $GLOBALS['wp']->query_vars ); 341 341 } 342 342 … … 352 352 ); 353 353 354 $this->assert Equals( $id, url_to_postid( get_permalink( $id ) ) );355 $this->assert Equals( $id, url_to_postid( site_url( '/example/example/' ) ) );356 $this->assert Equals( $id, url_to_postid( '/example/example/' ) );357 $this->assert Equals( $id, url_to_postid( '/example/example' ) );354 $this->assertSame( $id, url_to_postid( get_permalink( $id ) ) ); 355 $this->assertSame( $id, url_to_postid( site_url( '/example/example/' ) ) ); 356 $this->assertSame( $id, url_to_postid( '/example/example/' ) ); 357 $this->assertSame( $id, url_to_postid( '/example/example' ) ); 358 358 } 359 359 … … 374 374 // This url should NOT return a post ID. 375 375 $badurl = site_url( '/example-collision' ); 376 $this->assert Equals( 0, url_to_postid( $badurl ) );376 $this->assertSame( 0, url_to_postid( $badurl ) ); 377 377 } 378 378 … … 395 395 // This url should NOT return a post ID. 396 396 $badurl = network_home_url( '/example-collision' ); 397 $this->assert Equals( 0, url_to_postid( $badurl ) );397 $this->assertSame( 0, url_to_postid( $badurl ) ); 398 398 399 399 restore_current_blog(); … … 414 414 $post_id = self::factory()->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); 415 415 416 $this->assert Equals( $post_id, url_to_postid( get_permalink( $post_id ) ) );416 $this->assertSame( $post_id, url_to_postid( get_permalink( $post_id ) ) ); 417 417 } 418 418
Note: See TracChangeset
for help on using the changeset viewer.