Changeset 35225 for trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
- Timestamp:
- 10/16/2015 09:04:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
r34999 r35225 14 14 15 15 public function test_get_object_terms_by_slug() { 16 $post_id = $this->factory->post->create();16 $post_id = self::$factory->post->create(); 17 17 18 18 $terms_1 = array('Foo', 'Bar', 'Baz'); … … 32 32 */ 33 33 public function test_should_not_filter_out_duplicate_terms_associated_with_different_objects() { 34 $post_id1 = $this->factory->post->create();35 $post_id2 = $this->factory->post->create();36 $cat_id = $this->factory->category->create();37 $cat_id2 = $this->factory->category->create();34 $post_id1 = self::$factory->post->create(); 35 $post_id2 = self::$factory->post->create(); 36 $cat_id = self::$factory->category->create(); 37 $cat_id2 = self::$factory->category->create(); 38 38 wp_set_post_categories( $post_id1, array( $cat_id, $cat_id2 ) ); 39 39 wp_set_post_categories( $post_id2, $cat_id ); … … 55 55 */ 56 56 public function test_should_return_objects_with_int_properties() { 57 $post_id = $this->factory->post->create();57 $post_id = self::$factory->post->create(); 58 58 $term = wp_insert_term( 'one', $this->taxonomy ); 59 59 wp_set_object_terms( $post_id, $term, $this->taxonomy ); … … 74 74 */ 75 75 public function test_references_should_be_reset_after_wp_get_object_terms_filter() { 76 $post_id = $this->factory->post->create();76 $post_id = self::$factory->post->create(); 77 77 $terms_1 = array('foo', 'bar', 'baz'); 78 78 … … 87 87 88 88 public function test_orderby_name() { 89 $p = $this->factory->post->create();90 91 $t1 = $this->factory->term->create( array(89 $p = self::$factory->post->create(); 90 91 $t1 = self::$factory->term->create( array( 92 92 'taxonomy' => $this->taxonomy, 93 93 'name' => 'AAA', 94 94 ) ); 95 $t2 = $this->factory->term->create( array(95 $t2 = self::$factory->term->create( array( 96 96 'taxonomy' => $this->taxonomy, 97 97 'name' => 'ZZZ', 98 98 ) ); 99 $t3 = $this->factory->term->create( array(99 $t3 = self::$factory->term->create( array( 100 100 'taxonomy' => $this->taxonomy, 101 101 'name' => 'JJJ', … … 113 113 114 114 public function test_orderby_count() { 115 $posts = $this->factory->post->create_many( 3 );116 117 $t1 = $this->factory->term->create( array(115 $posts = self::$factory->post->create_many( 3 ); 116 117 $t1 = self::$factory->term->create( array( 118 118 'taxonomy' => $this->taxonomy, 119 119 'name' => 'AAA', 120 120 ) ); 121 $t2 = $this->factory->term->create( array(121 $t2 = self::$factory->term->create( array( 122 122 'taxonomy' => $this->taxonomy, 123 123 'name' => 'ZZZ', 124 124 ) ); 125 $t3 = $this->factory->term->create( array(125 $t3 = self::$factory->term->create( array( 126 126 'taxonomy' => $this->taxonomy, 127 127 'name' => 'JJJ', … … 141 141 142 142 public function test_orderby_slug() { 143 $p = $this->factory->post->create();144 145 $t1 = $this->factory->term->create( array(143 $p = self::$factory->post->create(); 144 145 $t1 = self::$factory->term->create( array( 146 146 'taxonomy' => $this->taxonomy, 147 147 'slug' => 'aaa', 148 148 ) ); 149 $t2 = $this->factory->term->create( array(149 $t2 = self::$factory->term->create( array( 150 150 'taxonomy' => $this->taxonomy, 151 151 'slug' => 'zzz', 152 152 ) ); 153 $t3 = $this->factory->term->create( array(153 $t3 = self::$factory->term->create( array( 154 154 'taxonomy' => $this->taxonomy, 155 155 'slug' => 'jjj', … … 167 167 168 168 public function test_orderby_term_group() { 169 $p = $this->factory->post->create();170 171 $t1 = $this->factory->term->create( array(172 'taxonomy' => $this->taxonomy, 173 ) ); 174 $t2 = $this->factory->term->create( array(175 'taxonomy' => $this->taxonomy, 176 ) ); 177 $t3 = $this->factory->term->create( array(169 $p = self::$factory->post->create(); 170 171 $t1 = self::$factory->term->create( array( 172 'taxonomy' => $this->taxonomy, 173 ) ); 174 $t2 = self::$factory->term->create( array( 175 'taxonomy' => $this->taxonomy, 176 ) ); 177 $t3 = self::$factory->term->create( array( 178 178 'taxonomy' => $this->taxonomy, 179 179 ) ); … … 196 196 197 197 public function test_orderby_term_order() { 198 $p = $this->factory->post->create();199 200 $t1 = $this->factory->term->create( array(201 'taxonomy' => $this->taxonomy, 202 ) ); 203 $t2 = $this->factory->term->create( array(204 'taxonomy' => $this->taxonomy, 205 ) ); 206 $t3 = $this->factory->term->create( array(198 $p = self::$factory->post->create(); 199 200 $t1 = self::$factory->term->create( array( 201 'taxonomy' => $this->taxonomy, 202 ) ); 203 $t2 = self::$factory->term->create( array( 204 'taxonomy' => $this->taxonomy, 205 ) ); 206 $t3 = self::$factory->term->create( array( 207 207 'taxonomy' => $this->taxonomy, 208 208 ) ); … … 232 232 */ 233 233 public function test_orderby_parent() { 234 $p = $this->factory->post->create();235 236 $t1 = $this->factory->term->create( array(237 'taxonomy' => $this->taxonomy, 238 ) ); 239 $t2 = $this->factory->term->create( array(240 'taxonomy' => $this->taxonomy, 241 ) ); 242 $t3 = $this->factory->term->create( array(234 $p = self::$factory->post->create(); 235 236 $t1 = self::$factory->term->create( array( 237 'taxonomy' => $this->taxonomy, 238 ) ); 239 $t2 = self::$factory->term->create( array( 240 'taxonomy' => $this->taxonomy, 241 ) ); 242 $t3 = self::$factory->term->create( array( 243 243 'taxonomy' => $this->taxonomy, 244 244 ) ); … … 270 270 register_taxonomy( 'wptests_tax_3', 'post' ); 271 271 272 $p = $this->factory->post->create();273 274 $t1 = $this->factory->term->create( array(275 'taxonomy' => $this->taxonomy, 276 ) ); 277 $t2 = $this->factory->term->create( array(272 $p = self::$factory->post->create(); 273 274 $t1 = self::$factory->term->create( array( 275 'taxonomy' => $this->taxonomy, 276 ) ); 277 $t2 = self::$factory->term->create( array( 278 278 'taxonomy' => 'wptests_tax_3', 279 279 ) ); 280 $t3 = $this->factory->term->create( array(280 $t3 = self::$factory->term->create( array( 281 281 'taxonomy' => 'wptests_tax_2', 282 282 ) ); … … 298 298 */ 299 299 public function test_orderby_tt_id() { 300 $p = $this->factory->post->create();301 302 $t1 = $this->factory->term->create( array(303 'taxonomy' => $this->taxonomy, 304 ) ); 305 $t2 = $this->factory->term->create( array(306 'taxonomy' => $this->taxonomy, 307 ) ); 308 $t3 = $this->factory->term->create( array(300 $p = self::$factory->post->create(); 301 302 $t1 = self::$factory->term->create( array( 303 'taxonomy' => $this->taxonomy, 304 ) ); 305 $t2 = self::$factory->term->create( array( 306 'taxonomy' => $this->taxonomy, 307 ) ); 308 $t3 = self::$factory->term->create( array( 309 309 'taxonomy' => $this->taxonomy, 310 310 ) ); … … 331 331 332 332 public function test_order_desc() { 333 $p = $this->factory->post->create();334 335 $t1 = $this->factory->term->create( array(333 $p = self::$factory->post->create(); 334 335 $t1 = self::$factory->term->create( array( 336 336 'taxonomy' => $this->taxonomy, 337 337 'name' => 'AAA', 338 338 ) ); 339 $t2 = $this->factory->term->create( array(339 $t2 = self::$factory->term->create( array( 340 340 'taxonomy' => $this->taxonomy, 341 341 'name' => 'ZZZ', 342 342 ) ); 343 $t3 = $this->factory->term->create( array(343 $t3 = self::$factory->term->create( array( 344 344 'taxonomy' => $this->taxonomy, 345 345 'name' => 'JJJ', … … 361 361 */ 362 362 public function test_parent() { 363 $t1 = $this->factory->term->create( array(364 'taxonomy' => $this->taxonomy, 365 ) ); 366 $t2 = $this->factory->term->create( array(367 'taxonomy' => $this->taxonomy, 368 ) ); 369 $t3 = $this->factory->term->create( array(363 $t1 = self::$factory->term->create( array( 364 'taxonomy' => $this->taxonomy, 365 ) ); 366 $t2 = self::$factory->term->create( array( 367 'taxonomy' => $this->taxonomy, 368 ) ); 369 $t3 = self::$factory->term->create( array( 370 370 'taxonomy' => $this->taxonomy, 371 371 'parent' => $t1, 372 372 ) ); 373 $t4 = $this->factory->term->create( array(373 $t4 = self::$factory->term->create( array( 374 374 'taxonomy' => $this->taxonomy, 375 375 'parent' => $t2, 376 376 ) ); 377 377 378 $p = $this->factory->post->create();378 $p = self::$factory->post->create(); 379 379 380 380 wp_set_object_terms( $p, array( $t1, $t2, $t3, $t3 ), $this->taxonomy ); … … 392 392 */ 393 393 public function test_parent_0() { 394 $t1 = $this->factory->term->create( array(395 'taxonomy' => $this->taxonomy, 396 ) ); 397 $t2 = $this->factory->term->create( array(398 'taxonomy' => $this->taxonomy, 399 ) ); 400 $t3 = $this->factory->term->create( array(394 $t1 = self::$factory->term->create( array( 395 'taxonomy' => $this->taxonomy, 396 ) ); 397 $t2 = self::$factory->term->create( array( 398 'taxonomy' => $this->taxonomy, 399 ) ); 400 $t3 = self::$factory->term->create( array( 401 401 'taxonomy' => $this->taxonomy, 402 402 'parent' => $t1, 403 403 ) ); 404 $t4 = $this->factory->term->create( array(404 $t4 = self::$factory->term->create( array( 405 405 'taxonomy' => $this->taxonomy, 406 406 'parent' => $t2, 407 407 ) ); 408 408 409 $p = $this->factory->post->create();409 $p = self::$factory->post->create(); 410 410 411 411 wp_set_object_terms( $p, array( $t1, $t2, $t3, $t3 ), $this->taxonomy ); … … 426 426 427 427 register_taxonomy( 'wptests_tax', 'post' ); 428 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );428 $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 429 429 add_term_meta( $terms[0], 'foo', 'bar' ); 430 430 add_term_meta( $terms[1], 'foo', 'bar' ); 431 431 add_term_meta( $terms[2], 'foo', 'bar' ); 432 432 433 $p = $this->factory->post->create();433 $p = self::$factory->post->create(); 434 434 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 435 435 … … 452 452 453 453 register_taxonomy( 'wptests_tax', 'post' ); 454 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );454 $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 455 455 add_term_meta( $terms[0], 'foo', 'bar' ); 456 456 add_term_meta( $terms[1], 'foo', 'bar' ); 457 457 add_term_meta( $terms[2], 'foo', 'bar' ); 458 458 459 $p = $this->factory->post->create();459 $p = self::$factory->post->create(); 460 460 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 461 461 … … 478 478 public function test_meta_query() { 479 479 register_taxonomy( 'wptests_tax', 'post' ); 480 $terms = $this->factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) );480 $terms = self::$factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) ); 481 481 add_term_meta( $terms[0], 'foo', 'bar' ); 482 482 add_term_meta( $terms[1], 'foo', 'bar' ); … … 484 484 add_term_meta( $terms[3], 'foob', 'ar' ); 485 485 486 $p = $this->factory->post->create();486 $p = self::$factory->post->create(); 487 487 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 488 488 … … 504 504 public function test_should_return_wp_term_objects_for_fields_all() { 505 505 register_taxonomy( 'wptests_tax', 'post' ); 506 $p = $this->factory->post->create();507 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );506 $p = self::$factory->post->create(); 507 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 508 508 wp_set_object_terms( $p, $t, 'wptests_tax' ); 509 509 … … 523 523 public function test_should_return_wp_term_objects_for_fields_all_with_object_id() { 524 524 register_taxonomy( 'wptests_tax', 'post' ); 525 $p = $this->factory->post->create();526 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );525 $p = self::$factory->post->create(); 526 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 527 527 wp_set_object_terms( $p, $t, 'wptests_tax' ); 528 528 … … 544 544 545 545 register_taxonomy( 'wptests_tax', 'post' ); 546 $p = $this->factory->post->create();547 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );546 $p = self::$factory->post->create(); 547 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 548 548 wp_set_object_terms( $p, $t, 'wptests_tax' ); 549 549 … … 562 562 public function test_object_id_should_not_be_cached_with_term_object() { 563 563 register_taxonomy( 'wptests_tax', 'post' ); 564 $p = $this->factory->post->create();565 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );564 $p = self::$factory->post->create(); 565 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 566 566 wp_set_object_terms( $p, $t, 'wptests_tax' ); 567 567 … … 586 586 register_taxonomy( 'wptests_tax1', 'post' ); 587 587 register_taxonomy( 'wptests_tax2', 'post' ); 588 $p = $this->factory->post->create();589 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );590 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );588 $p = self::$factory->post->create(); 589 $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 590 $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 591 591 wp_set_object_terms( $p, $t1, 'wptests_tax1' ); 592 592 wp_set_object_terms( $p, $t2, 'wptests_tax2' ); … … 612 612 public function test_object_id_should_be_set_on_objects_that_share_terms() { 613 613 register_taxonomy( 'wptests_tax', 'post' ); 614 $posts = $this->factory->post->create_many( 2 );615 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );614 $posts = self::$factory->post->create_many( 2 ); 615 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 616 616 wp_set_object_terms( $posts[0], $t, 'wptests_tax' ); 617 617 wp_set_object_terms( $posts[1], $t, 'wptests_tax' );
Note: See TracChangeset
for help on using the changeset viewer.