Changeset 35225 for trunk/tests/phpunit/tests/taxonomy.php
- Timestamp:
- 10/16/2015 09:04:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/taxonomy.php
r34247 r35225 35 35 36 36 function test_get_the_taxonomies() { 37 $post_id = $this->factory->post->create();37 $post_id = self::$factory->post->create(); 38 38 39 39 $taxes = get_the_taxonomies( $post_id ); … … 41 41 $this->assertEquals( array( 'category' ), array_keys( $taxes ) ); 42 42 43 $id = $this->factory->tag->create();43 $id = self::$factory->tag->create(); 44 44 wp_set_post_tags( $post_id, array( $id ) ); 45 45 … … 54 54 */ 55 55 public function test_get_the_taxonomies_term_template() { 56 $post_id = $this->factory->post->create();56 $post_id = self::$factory->post->create(); 57 57 58 58 $taxes = get_the_taxonomies( $post_id, array( 'term_template' => '%2$s' ) ); … … 65 65 66 66 function test_the_taxonomies() { 67 $post_id = $this->factory->post->create();67 $post_id = self::$factory->post->create(); 68 68 69 69 ob_start(); … … 80 80 */ 81 81 function test_the_taxonomies_term_template() { 82 $post_id = $this->factory->post->create();82 $post_id = self::$factory->post->create(); 83 83 84 84 $output = get_echo( 'the_taxonomies', array( array( 'post' => $post_id, 'term_template' => '%2$s' ) ) ); … … 263 263 264 264 public function test_get_objects_in_term_should_return_objects_ids() { 265 $tag_id = $this->factory->tag->create();266 $cat_id = $this->factory->category->create();265 $tag_id = self::$factory->tag->create(); 266 $cat_id = self::$factory->category->create(); 267 267 $posts_with_tag = array(); 268 268 $posts_with_category = array(); 269 269 270 270 for ( $i = 0; $i < 3; $i++ ) { 271 $post_id = $this->factory->post->create();271 $post_id = self::$factory->post->create(); 272 272 wp_set_post_tags( $post_id, array( $tag_id ) ); 273 273 $posts_with_tag[] = $post_id; … … 275 275 276 276 for ( $i = 0; $i < 3; $i++ ) { 277 $post_id = $this->factory->post->create();277 $post_id = self::$factory->post->create(); 278 278 wp_set_post_categories( $post_id, array( $cat_id ) ); 279 279 $posts_with_category[] = $post_id; … … 281 281 282 282 for ( $i = 0; $i < 3; $i++ ) { 283 $this->factory->post->create();283 self::$factory->post->create(); 284 284 } 285 285 … … 296 296 */ 297 297 function test_in_category() { 298 $post = $this->factory->post->create_and_get();298 $post = self::$factory->post->create_and_get(); 299 299 300 300 // in_category() returns false when first parameter is empty() … … 347 347 public function test_get_ancestors_taxonomy_non_hierarchical() { 348 348 register_taxonomy( 'wptests_tax', 'post' ); 349 $t = $this->factory->term->create( array(349 $t = self::$factory->term->create( array( 350 350 'taxonomy' => 'wptests_tax', 351 351 ) ); … … 359 359 'hierarchical' => true, 360 360 ) ); 361 $t1 = $this->factory->term->create( array(362 'taxonomy' => 'wptests_tax', 363 ) ); 364 $t2 = $this->factory->term->create( array(361 $t1 = self::$factory->term->create( array( 362 'taxonomy' => 'wptests_tax', 363 ) ); 364 $t2 = self::$factory->term->create( array( 365 365 'taxonomy' => 'wptests_tax', 366 366 'parent' => $t1, 367 367 ) ); 368 $t3 = $this->factory->term->create( array(368 $t3 = self::$factory->term->create( array( 369 369 'taxonomy' => 'wptests_tax', 370 370 'parent' => $t2, 371 371 ) ); 372 $t4 = $this->factory->term->create( array(372 $t4 = self::$factory->term->create( array( 373 373 'taxonomy' => 'wptests_tax', 374 374 'parent' => $t1, … … 381 381 public function test_get_ancestors_post_type_non_hierarchical() { 382 382 register_post_type( 'wptests_pt' ); 383 $p = $this->factory->post->create( array(383 $p = self::$factory->post->create( array( 384 384 'taxonomy' => 'wptests_pt', 385 385 ) ); … … 392 392 'hierarchical' => true, 393 393 ) ); 394 $p1 = $this->factory->post->create( array(394 $p1 = self::$factory->post->create( array( 395 395 'post_type' => 'wptests_pt', 396 396 ) ); 397 $p2 = $this->factory->post->create( array(397 $p2 = self::$factory->post->create( array( 398 398 'post_type' => 'wptests_pt', 399 399 'post_parent' => $p1, 400 400 ) ); 401 $p3 = $this->factory->post->create( array(401 $p3 = self::$factory->post->create( array( 402 402 'post_type' => 'wptests_pt', 403 403 'post_parent' => $p2, 404 404 ) ); 405 $p4 = $this->factory->post->create( array(405 $p4 = self::$factory->post->create( array( 406 406 'post_type' => 'wptests_pt', 407 407 'post_parent' => $p1, … … 419 419 'hierarchical' => true, 420 420 ) ); 421 $p1 = $this->factory->post->create( array(421 $p1 = self::$factory->post->create( array( 422 422 'post_type' => 'wptests_conflict', 423 423 ) ); 424 $p2 = $this->factory->post->create( array(424 $p2 = self::$factory->post->create( array( 425 425 'post_type' => 'wptests_conflict', 426 426 'post_parent' => $p1, … … 430 430 'hierarchical' => true, 431 431 ) ); 432 $t1 = $this->factory->term->create( array(432 $t1 = self::$factory->term->create( array( 433 433 'taxonomy' => 'wptests_conflict', 434 434 ) ); 435 $t2 = $this->factory->term->create( array(435 $t2 = self::$factory->term->create( array( 436 436 'taxonomy' => 'wptests_conflict', 437 437 'parent' => $t1, … … 452 452 ) ); 453 453 454 $t = $this->factory->term->create_and_get( array(455 'taxonomy' => 'wptests_tax', 456 ) ); 457 458 $p = $this->factory->post->create();454 $t = self::$factory->term->create_and_get( array( 455 'taxonomy' => 'wptests_tax', 456 ) ); 457 458 $p = self::$factory->post->create(); 459 459 wp_set_object_terms( $p, $t->slug, 'wptests_tax' ); 460 460 … … 472 472 ) ); 473 473 474 $t = $this->factory->term->create_and_get( array(475 'taxonomy' => 'wptests_tax', 476 ) ); 477 478 $p = $this->factory->post->create();474 $t = self::$factory->term->create_and_get( array( 475 'taxonomy' => 'wptests_tax', 476 ) ); 477 478 $p = self::$factory->post->create(); 479 479 wp_set_object_terms( $p, $t->slug, 'wptests_tax' ); 480 480
Note: See TracChangeset
for help on using the changeset viewer.