Changeset 48937 for trunk/tests/phpunit/tests/post/getPages.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/getPages.php
r47122 r48937 21 21 22 22 $pages = get_pages(); 23 $this->assert Equals( 3, count( $pages ) );23 $this->assertSame( 3, count( $pages ) ); 24 24 $time1 = wp_cache_get( 'last_changed', 'posts' ); 25 25 $this->assertNotEmpty( $time1 ); … … 31 31 // Again. num_queries and last_changed should remain the same. 32 32 $pages = get_pages(); 33 $this->assert Equals( 3, count( $pages ) );34 $this->assert Equals( $time1, wp_cache_get( 'last_changed', 'posts' ) );35 $this->assert Equals( $num_queries, $wpdb->num_queries );33 $this->assertSame( 3, count( $pages ) ); 34 $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 35 $this->assertSame( $num_queries, $wpdb->num_queries ); 36 36 foreach ( $pages as $page ) { 37 37 $this->assertInstanceOf( 'WP_Post', $page ); … … 41 41 // different args to get_pages(). num_queries should bump by 1. 42 42 $pages = get_pages( array( 'number' => 2 ) ); 43 $this->assert Equals( 2, count( $pages ) );44 $this->assert Equals( $time1, wp_cache_get( 'last_changed', 'posts' ) );45 $this->assert Equals( $num_queries + 1, $wpdb->num_queries );43 $this->assertSame( 2, count( $pages ) ); 44 $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 45 $this->assertSame( $num_queries + 1, $wpdb->num_queries ); 46 46 foreach ( $pages as $page ) { 47 47 $this->assertInstanceOf( 'WP_Post', $page ); … … 52 52 // Again. num_queries and last_changed should remain the same. 53 53 $pages = get_pages( array( 'number' => 2 ) ); 54 $this->assert Equals( 2, count( $pages ) );55 $this->assert Equals( $time1, wp_cache_get( 'last_changed', 'posts' ) );56 $this->assert Equals( $num_queries, $wpdb->num_queries );54 $this->assertSame( 2, count( $pages ) ); 55 $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 56 $this->assertSame( $num_queries, $wpdb->num_queries ); 57 57 foreach ( $pages as $page ) { 58 58 $this->assertInstanceOf( 'WP_Post', $page ); … … 61 61 // Do the first query again. The interim queries should not affect it. 62 62 $pages = get_pages(); 63 $this->assert Equals( 3, count( $pages ) );64 $this->assert Equals( $time1, wp_cache_get( 'last_changed', 'posts' ) );65 $this->assert Equals( $num_queries, $wpdb->num_queries );63 $this->assertSame( 3, count( $pages ) ); 64 $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 65 $this->assertSame( $num_queries, $wpdb->num_queries ); 66 66 foreach ( $pages as $page ) { 67 67 $this->assertInstanceOf( 'WP_Post', $page ); … … 76 76 // last_changed bumped so num_queries should increment. 77 77 $pages = get_pages( array( 'number' => 2 ) ); 78 $this->assert Equals( 2, count( $pages ) );79 $this->assert Equals( $time2, wp_cache_get( 'last_changed', 'posts' ) );80 $this->assert Equals( $num_queries + 1, $wpdb->num_queries );78 $this->assertSame( 2, count( $pages ) ); 79 $this->assertSame( $time2, wp_cache_get( 'last_changed', 'posts' ) ); 80 $this->assertSame( $num_queries + 1, $wpdb->num_queries ); 81 81 foreach ( $pages as $page ) { 82 82 $this->assertInstanceOf( 'WP_Post', $page ); … … 96 96 // num_queries should bump after wp_delete_post() bumps last_changed. 97 97 $pages = get_pages(); 98 $this->assert Equals( 2, count( $pages ) );99 $this->assert Equals( $last_changed, wp_cache_get( 'last_changed', 'posts' ) );100 $this->assert Equals( $num_queries + 1, $wpdb->num_queries );98 $this->assertSame( 2, count( $pages ) ); 99 $this->assertSame( $last_changed, wp_cache_get( 'last_changed', 'posts' ) ); 100 $this->assertSame( $num_queries + 1, $wpdb->num_queries ); 101 101 foreach ( $pages as $page ) { 102 102 $this->assertInstanceOf( 'WP_Post', $page ); … … 260 260 add_post_meta( $posts[2], 'some-meta-key', '1' ); 261 261 262 $this->assert Equals(262 $this->assertSame( 263 263 1, 264 264 count( … … 271 271 ) 272 272 ); 273 $this->assert Equals(273 $this->assertSame( 274 274 1, 275 275 count( … … 282 282 ) 283 283 ); 284 $this->assert Equals( 3, count( get_pages( array( 'meta_key' => 'some-meta-key' ) ) ) );284 $this->assertSame( 3, count( get_pages( array( 'meta_key' => 'some-meta-key' ) ) ) ); 285 285 } 286 286 … … 303 303 $inc_result = wp_list_pluck( $include, 'ID' ); 304 304 sort( $inc_result ); 305 $this->assert Equals( $inc, $inc_result );305 $this->assertSame( $inc, $inc_result ); 306 306 307 307 $exclude = get_pages( array( 'exclude' => $exc ) ); 308 308 $exc_result = wp_list_pluck( $exclude, 'ID' ); 309 309 sort( $exc_result ); 310 $this->assert Equals( $inc, $exc_result );310 $this->assertSame( $inc, $exc_result ); 311 311 } 312 312 … … 377 377 preg_match_all( '#<option#', wp_dropdown_pages( 'echo=0' ), $matches ); 378 378 379 $this->assert Equals( 5, count( $matches[0] ) );379 $this->assertSame( 5, count( $matches[0] ) ); 380 380 } 381 381 … … 638 638 $this->go_to( "/?p=$post_id&post_type=$type" ); 639 639 640 $this->assert Equals( $post_id, get_queried_object_id() );640 $this->assertSame( $post_id, get_queried_object_id() ); 641 641 642 642 $output = wp_list_pages( … … 649 649 650 650 $this->assertNotEmpty( $output ); 651 $this->assert Equals( 2, substr_count( $output, 'class="page_item ' ) );651 $this->assertSame( 2, substr_count( $output, 'class="page_item ' ) ); 652 652 $this->assertContains( 'current_page_item', $output ); 653 $this->assert Equals( 1, substr_count( $output, 'current_page_item' ) );653 $this->assertSame( 1, substr_count( $output, 'current_page_item' ) ); 654 654 655 655 _unregister_post_type( $type ); … … 716 716 $pages = get_pages(); // Database gets queried. 717 717 718 $this->assert Equals( $num_queries + 1, $wpdb->num_queries );718 $this->assertSame( $num_queries + 1, $wpdb->num_queries ); 719 719 720 720 $num_queries = $wpdb->num_queries; … … 722 722 $pages = get_pages(); // Database should not get queried. 723 723 724 $this->assert Equals( $num_queries, $wpdb->num_queries );724 $this->assertSame( $num_queries, $wpdb->num_queries ); 725 725 } 726 726 }
Note: See TracChangeset
for help on using the changeset viewer.