Changeset 35242 for trunk/tests/phpunit/tests/post/query.php
- Timestamp:
- 10/17/2015 06:02:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/query.php
r35225 r35242 12 12 $q = new WP_Query(); 13 13 14 $term_id = self:: $factory->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );15 $term_id2 = self:: $factory->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) );16 $post_id = self:: $factory->post->create();14 $term_id = self::factory()->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) ); 15 $term_id2 = self::factory()->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) ); 16 $post_id = self::factory()->post->create(); 17 17 18 18 wp_set_post_categories( $post_id, $term_id ); … … 42 42 */ 43 43 function test_empty_category__in() { 44 $cat_id = self:: $factory->category->create();45 $post_id = self:: $factory->post->create();44 $cat_id = self::factory()->category->create(); 45 $post_id = self::factory()->post->create(); 46 46 wp_set_post_categories( $post_id, $cat_id ); 47 47 … … 72 72 function test_the_posts_filter() { 73 73 // Create posts and clear their caches. 74 $post_ids = self:: $factory->post->create_many( 4 );74 $post_ids = self::factory()->post->create_many( 4 ); 75 75 foreach ( $post_ids as $post_id ) 76 76 clean_post_cache( $post_id ); … … 116 116 117 117 function test_post__in_ordering() { 118 $post_id1 = self:: $factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );119 $post_id2 = self:: $factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );120 $post_id3 = self:: $factory->post->create( array(118 $post_id1 = self::factory()->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) ); 119 $post_id2 = self::factory()->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) ); 120 $post_id3 = self::factory()->post->create( array( 121 121 'post_type' => 'page', 122 122 'post_parent' => $post_id2, 123 123 'menu_order' => rand( 1, 100 ) 124 124 ) ); 125 $post_id4 = self:: $factory->post->create( array(125 $post_id4 = self::factory()->post->create( array( 126 126 'post_type' => 'page', 127 127 'post_parent' => $post_id2, 128 128 'menu_order' => rand( 1, 100 ) 129 129 ) ); 130 $post_id5 = self:: $factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );130 $post_id5 = self::factory()->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) ); 131 131 132 132 $ordered = array( $post_id2, $post_id4, $post_id3, $post_id1, $post_id5 ); … … 141 141 142 142 function test_post__in_attachment_ordering() { 143 $post_id = self:: $factory->post->create();143 $post_id = self::factory()->post->create(); 144 144 $att_ids = array(); 145 145 $file = DIR_TESTDATA . '/images/canola.jpg'; 146 $att_ids[1] = self:: $factory->attachment->create_object( $file, $post_id, array(147 'post_mime_type' => 'image/jpeg', 148 'menu_order' => rand( 1, 100 ) 149 ) ); 150 $att_ids[2] = self:: $factory->attachment->create_object( $file, $post_id, array(151 'post_mime_type' => 'image/jpeg', 152 'menu_order' => rand( 1, 100 ) 153 ) ); 154 $att_ids[3] = self:: $factory->attachment->create_object( $file, $post_id, array(155 'post_mime_type' => 'image/jpeg', 156 'menu_order' => rand( 1, 100 ) 157 ) ); 158 $att_ids[4] = self:: $factory->attachment->create_object( $file, $post_id, array(159 'post_mime_type' => 'image/jpeg', 160 'menu_order' => rand( 1, 100 ) 161 ) ); 162 $att_ids[5] = self:: $factory->attachment->create_object( $file, $post_id, array(146 $att_ids[1] = self::factory()->attachment->create_object( $file, $post_id, array( 147 'post_mime_type' => 'image/jpeg', 148 'menu_order' => rand( 1, 100 ) 149 ) ); 150 $att_ids[2] = self::factory()->attachment->create_object( $file, $post_id, array( 151 'post_mime_type' => 'image/jpeg', 152 'menu_order' => rand( 1, 100 ) 153 ) ); 154 $att_ids[3] = self::factory()->attachment->create_object( $file, $post_id, array( 155 'post_mime_type' => 'image/jpeg', 156 'menu_order' => rand( 1, 100 ) 157 ) ); 158 $att_ids[4] = self::factory()->attachment->create_object( $file, $post_id, array( 159 'post_mime_type' => 'image/jpeg', 160 'menu_order' => rand( 1, 100 ) 161 ) ); 162 $att_ids[5] = self::factory()->attachment->create_object( $file, $post_id, array( 163 163 'post_mime_type' => 'image/jpeg', 164 164 'menu_order' => rand( 1, 100 ) … … 312 312 $q = new WP_Query(); 313 313 314 $post_ids[0] = self:: $factory->post->create( array( 'post_title' => 'woo', 'post_date' => '2015-07-23 00:00:00' ) );315 $post_ids[1] = self:: $factory->post->create( array( 'post_title' => 'hoo', 'post_date' => '2015-07-23 00:00:00' ) );316 $post_ids[2] = self:: $factory->post->create( array( 'post_title' => 'test', 'post_date' => '2015-07-23 00:00:00' ) );317 $post_ids[3] = self:: $factory->post->create( array( 'post_title' => 'me', 'post_date' => '2015-07-23 00:00:00' ) );314 $post_ids[0] = self::factory()->post->create( array( 'post_title' => 'woo', 'post_date' => '2015-07-23 00:00:00' ) ); 315 $post_ids[1] = self::factory()->post->create( array( 'post_title' => 'hoo', 'post_date' => '2015-07-23 00:00:00' ) ); 316 $post_ids[2] = self::factory()->post->create( array( 'post_title' => 'test', 'post_date' => '2015-07-23 00:00:00' ) ); 317 $post_ids[3] = self::factory()->post->create( array( 'post_title' => 'me', 'post_date' => '2015-07-23 00:00:00' ) ); 318 318 319 319 $requested = array( $post_ids[0], $post_ids[3] );
Note: See TracChangeset
for help on using the changeset viewer.