Changeset 42343 for trunk/tests/phpunit/tests/term/wpInsertTerm.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/term/wpInsertTerm.php (modified) (38 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/wpInsertTerm.php
r40145 r42343 12 12 // otherwise term_ids and term_taxonomy_ids might be identical, which could mask bugs 13 13 $term = 'seed_term'; 14 foreach (get_object_taxonomies('post') as $tax)14 foreach ( get_object_taxonomies( 'post' ) as $tax ) { 15 15 wp_insert_term( $term, $tax ); 16 } 16 17 } 17 18 … … 22 23 // a new unused term 23 24 $term = 'term'; 24 $this->assertNull( term_exists( $term) );25 $this->assertNull( term_exists( $term ) ); 25 26 26 27 $initial_count = wp_count_terms( $taxonomy ); … … 34 35 35 36 // make sure the term exists 36 $this->assertTrue( term_exists( $term) > 0 );37 $this->assertTrue( term_exists( $t['term_id']) > 0 );37 $this->assertTrue( term_exists( $term ) > 0 ); 38 $this->assertTrue( term_exists( $t['term_id'] ) > 0 ); 38 39 39 40 // now delete it … … 41 42 $this->assertTrue( wp_delete_term( $t['term_id'], $taxonomy ) ); 42 43 remove_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 5 ); 43 $this->assertNull( term_exists( $term) );44 $this->assertNull( term_exists( $t['term_id']) );44 $this->assertNull( term_exists( $term ) ); 45 $this->assertNull( term_exists( $t['term_id'] ) ); 45 46 $this->assertEquals( $initial_count, wp_count_terms( $taxonomy ) ); 46 47 } … … 77 78 78 79 public function test_wp_insert_term_parent_does_not_exist() { 79 $found = wp_insert_term( 'foo', 'post_tag', array( 80 'parent' => 999999, 81 ) ); 80 $found = wp_insert_term( 81 'foo', 'post_tag', array( 82 'parent' => 999999, 83 ) 84 ); 82 85 83 86 $this->assertWPError( $found ); … … 97 100 public function test_wp_insert_term_unslash_description() { 98 101 register_taxonomy( 'wptests_tax', 'post' ); 99 $found = wp_insert_term( 'Quality', 'wptests_tax', array( 100 'description' => 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy', 101 ) ); 102 $found = wp_insert_term( 103 'Quality', 'wptests_tax', array( 104 'description' => 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy', 105 ) 106 ); 102 107 103 108 $term = get_term( $found['term_id'], 'wptests_tax' ); … … 109 114 public function test_wp_insert_term_parent_string() { 110 115 register_taxonomy( 'wptests_tax', 'post' ); 111 $found = wp_insert_term( 'Quality', 'wptests_tax', array( 112 'parent' => 'foo1', 113 ) ); 116 $found = wp_insert_term( 117 'Quality', 'wptests_tax', array( 118 'parent' => 'foo1', 119 ) 120 ); 114 121 115 122 $term = get_term( $found['term_id'], 'wptests_tax' ); … … 122 129 public function test_wp_insert_term_slug_empty_string() { 123 130 register_taxonomy( 'wptests_tax', 'post' ); 124 $found = wp_insert_term( 'Quality', 'wptests_tax', array( 125 'slug' => '', 126 ) ); 131 $found = wp_insert_term( 132 'Quality', 'wptests_tax', array( 133 'slug' => '', 134 ) 135 ); 127 136 128 137 $term = get_term( $found['term_id'], 'wptests_tax' ); … … 135 144 public function test_wp_insert_term_slug_whitespace_string() { 136 145 register_taxonomy( 'wptests_tax', 'post' ); 137 $found = wp_insert_term( 'Quality', 'wptests_tax', array( 138 'slug' => ' ', 139 ) ); 146 $found = wp_insert_term( 147 'Quality', 'wptests_tax', array( 148 'slug' => ' ', 149 ) 150 ); 140 151 141 152 $term = get_term( $found['term_id'], 'wptests_tax' ); … … 147 158 public function test_wp_insert_term_slug_0() { 148 159 register_taxonomy( 'wptests_tax', 'post' ); 149 $found = wp_insert_term( 'Quality', 'wptests_tax', array( 150 'slug' => 0, 151 ) ); 160 $found = wp_insert_term( 161 'Quality', 'wptests_tax', array( 162 'slug' => 0, 163 ) 164 ); 152 165 153 166 $term = get_term( $found['term_id'], 'wptests_tax' ); … … 166 179 167 180 // Test existing term name with unique slug 168 $term1 = self::factory()->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) ); 181 $term1 = self::factory()->tag->create( 182 array( 183 'name' => 'Bozo', 184 'slug' => 'bozo1', 185 ) 186 ); 169 187 $this->assertNotWPError( $term1 ); 170 188 … … 188 206 189 207 // Test named terms with only special characters 190 $term8 = self::factory()->tag->create( array( 'name' => '$' ) );191 $term9 = self::factory()->tag->create( array( 'name' => '$$' ) );208 $term8 = self::factory()->tag->create( array( 'name' => '$' ) ); 209 $term9 = self::factory()->tag->create( array( 'name' => '$$' ) ); 192 210 $term10 = self::factory()->tag->create( array( 'name' => '$$$' ) ); 193 211 $term11 = self::factory()->tag->create( array( 'name' => '$$$$' ) ); … … 204 222 $term14 = self::factory()->tag->create( array( 'name' => 'A' ) ); 205 223 $this->assertWPError( $term14 ); 206 $term15 = self::factory()->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) ); 224 $term15 = self::factory()->tag->create( 225 array( 226 'name' => 'A+', 227 'slug' => 'a', 228 ) 229 ); 207 230 $this->assertNotWPError( $term15 ); 208 231 $term16 = self::factory()->tag->create( array( 'name' => 'A+' ) ); … … 210 233 $term17 = self::factory()->tag->create( array( 'name' => 'A++' ) ); 211 234 $this->assertNotWPError( $term17 ); 212 $term18 = self::factory()->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) ); 235 $term18 = self::factory()->tag->create( 236 array( 237 'name' => 'A-', 238 'slug' => 'a', 239 ) 240 ); 213 241 $this->assertNotWPError( $term18 ); 214 242 $term19 = self::factory()->tag->create( array( 'name' => 'A-' ) ); … … 223 251 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_non_hierarchical_taxonomy() { 224 252 register_taxonomy( 'wptests_tax', 'post' ); 225 $t1 = self::factory()->term->create( array( 226 'name' => 'Foo', 227 'slug' => 'foo', 228 'taxonomy' => 'wptests_tax', 229 ) ); 230 231 $t2 = wp_insert_term( 'Foo', 'wptests_tax', array( 232 'slug' => 'foo', 233 ) ); 253 $t1 = self::factory()->term->create( 254 array( 255 'name' => 'Foo', 256 'slug' => 'foo', 257 'taxonomy' => 'wptests_tax', 258 ) 259 ); 260 261 $t2 = wp_insert_term( 262 'Foo', 'wptests_tax', array( 263 'slug' => 'foo', 264 ) 265 ); 234 266 235 267 $this->assertWPError( $t2 ); … … 242 274 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_in_non_hierarchical_taxonomy() { 243 275 register_taxonomy( 'wptests_tax', 'post' ); 244 $t1 = self::factory()->term->create( array( 245 'name' => 'Foo', 246 'slug' => 'foo', 247 'taxonomy' => 'wptests_tax', 248 ) ); 249 250 $t2 = self::factory()->term->create( array( 251 'name' => 'Bar', 252 'slug' => 'bar', 253 'taxonomy' => 'wptests_tax', 254 ) ); 255 256 $t3 = wp_insert_term( 'Foo', 'wptests_tax', array( 257 'slug' => 'bar', 258 ) ); 276 $t1 = self::factory()->term->create( 277 array( 278 'name' => 'Foo', 279 'slug' => 'foo', 280 'taxonomy' => 'wptests_tax', 281 ) 282 ); 283 284 $t2 = self::factory()->term->create( 285 array( 286 'name' => 'Bar', 287 'slug' => 'bar', 288 'taxonomy' => 'wptests_tax', 289 ) 290 ); 291 292 $t3 = wp_insert_term( 293 'Foo', 'wptests_tax', array( 294 'slug' => 'bar', 295 ) 296 ); 259 297 260 298 $this->assertWPError( $t3 ); … … 267 305 public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_non_hierarchical_taxonomy() { 268 306 register_taxonomy( 'wptests_tax', 'post' ); 269 $t1 = self::factory()->term->create( array( 270 'name' => 'Foo', 271 'slug' => 'foo', 272 'taxonomy' => 'wptests_tax', 273 ) ); 274 275 $t2 = wp_insert_term( 'Foo', 'wptests_tax', array( 276 'slug' => 'foo-unique', 277 ) ); 307 $t1 = self::factory()->term->create( 308 array( 309 'name' => 'Foo', 310 'slug' => 'foo', 311 'taxonomy' => 'wptests_tax', 312 ) 313 ); 314 315 $t2 = wp_insert_term( 316 'Foo', 'wptests_tax', array( 317 'slug' => 'foo-unique', 318 ) 319 ); 278 320 279 321 $this->assertNotWPError( $t2 ); … … 289 331 public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_non_hierarchical_taxonomy() { 290 332 register_taxonomy( 'wptests_tax', 'post' ); 291 $t1 = self::factory()->term->create( array( 292 'name' => 'Foo', 293 'slug' => 'foo', 294 'taxonomy' => 'wptests_tax', 295 ) ); 333 $t1 = self::factory()->term->create( 334 array( 335 'name' => 'Foo', 336 'slug' => 'foo', 337 'taxonomy' => 'wptests_tax', 338 ) 339 ); 296 340 297 341 $t2 = wp_insert_term( 'Foo', 'wptests_tax' ); … … 306 350 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_hierarchical_taxonomy() { 307 351 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 308 $t1 = self::factory()->term->create( array( 309 'name' => 'Foo', 310 'slug' => 'foo', 311 'taxonomy' => 'wptests_tax', 312 ) ); 313 314 $t2 = wp_insert_term( 'Foo', 'wptests_tax', array( 315 'slug' => 'foo', 316 ) ); 352 $t1 = self::factory()->term->create( 353 array( 354 'name' => 'Foo', 355 'slug' => 'foo', 356 'taxonomy' => 'wptests_tax', 357 ) 358 ); 359 360 $t2 = wp_insert_term( 361 'Foo', 'wptests_tax', array( 362 'slug' => 'foo', 363 ) 364 ); 317 365 318 366 $this->assertWPError( $t2 ); … … 325 373 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_at_same_hierarchy_level_in_hierarchical_taxonomy() { 326 374 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 327 $t1 = self::factory()->term->create( array( 328 'name' => 'Foo', 329 'slug' => 'foo', 330 'taxonomy' => 'wptests_tax', 331 ) ); 332 333 $t2 = self::factory()->term->create( array( 334 'name' => 'Bar', 335 'slug' => 'bar', 336 'taxonomy' => 'wptests_tax', 337 ) ); 338 339 $t3 = wp_insert_term( 'Foo', 'wptests_tax', array( 340 'slug' => 'bar', 341 ) ); 375 $t1 = self::factory()->term->create( 376 array( 377 'name' => 'Foo', 378 'slug' => 'foo', 379 'taxonomy' => 'wptests_tax', 380 ) 381 ); 382 383 $t2 = self::factory()->term->create( 384 array( 385 'name' => 'Bar', 386 'slug' => 'bar', 387 'taxonomy' => 'wptests_tax', 388 ) 389 ); 390 391 $t3 = wp_insert_term( 392 'Foo', 'wptests_tax', array( 393 'slug' => 'bar', 394 ) 395 ); 342 396 343 397 $this->assertWPError( $t3 ); … … 350 404 public function test_wp_insert_term_should_allow_duplicate_names_when_slug_is_a_duplicate_of_a_term_at_different_hierarchy_level_in_hierarchical_taxonomy() { 351 405 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 352 $t1 = self::factory()->term->create( array( 353 'name' => 'Foo', 354 'slug' => 'foo', 355 'taxonomy' => 'wptests_tax', 356 ) ); 406 $t1 = self::factory()->term->create( 407 array( 408 'name' => 'Foo', 409 'slug' => 'foo', 410 'taxonomy' => 'wptests_tax', 411 ) 412 ); 357 413 358 414 $t2 = self::factory()->term->create(); 359 415 360 $t3 = self::factory()->term->create( array( 361 'name' => 'Bar', 362 'slug' => 'bar', 363 'parent' => $t2, 364 'taxonomy' => 'wptests_tax', 365 ) ); 366 367 $t4 = wp_insert_term( 'Foo', 'wptests_tax', array( 368 'slug' => 'bar', 369 ) ); 416 $t3 = self::factory()->term->create( 417 array( 418 'name' => 'Bar', 419 'slug' => 'bar', 420 'parent' => $t2, 421 'taxonomy' => 'wptests_tax', 422 ) 423 ); 424 425 $t4 = wp_insert_term( 426 'Foo', 'wptests_tax', array( 427 'slug' => 'bar', 428 ) 429 ); 370 430 371 431 $this->assertNotWPError( $t4 ); … … 382 442 public function test_duplicate_name_check_should_fail_when_no_slug_is_provided_even_when_slugs_would_not_clash() { 383 443 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 384 $t1 = self::factory()->term->create( array( 385 'name' => 'Foo', 386 'slug' => 'foo-no-conflict', 387 'taxonomy' => 'wptests_tax', 388 ) ); 444 $t1 = self::factory()->term->create( 445 array( 446 'name' => 'Foo', 447 'slug' => 'foo-no-conflict', 448 'taxonomy' => 'wptests_tax', 449 ) 450 ); 389 451 390 452 $error = wp_insert_term( 'Foo', 'wptests_tax' ); … … 400 462 public function test_error_should_reference_correct_term_when_rejected_as_duplicate() { 401 463 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 402 $t1 = self::factory()->term->create( array( 403 'name' => 'Foo', 404 'slug' => 'foo', 405 'taxonomy' => 'wptests_tax', 406 ) ); 407 408 $t2 = self::factory()->term->create( array( 409 'name' => 'Bar', 410 'slug' => 'bar', 411 'taxonomy' => 'wptests_tax', 412 ) ); 413 414 $t1_child = wp_insert_term( 'Child', 'wptests_tax', array( 415 'parent' => $t1, 416 ) ); 417 418 $t2_child = wp_insert_term( 'Child', 'wptests_tax', array( 419 'parent' => $t2, 420 ) ); 421 422 $error = wp_insert_term( 'Child', 'wptests_tax', array( 423 'parent' => $t2, 424 ) ); 464 $t1 = self::factory()->term->create( 465 array( 466 'name' => 'Foo', 467 'slug' => 'foo', 468 'taxonomy' => 'wptests_tax', 469 ) 470 ); 471 472 $t2 = self::factory()->term->create( 473 array( 474 'name' => 'Bar', 475 'slug' => 'bar', 476 'taxonomy' => 'wptests_tax', 477 ) 478 ); 479 480 $t1_child = wp_insert_term( 481 'Child', 'wptests_tax', array( 482 'parent' => $t1, 483 ) 484 ); 485 486 $t2_child = wp_insert_term( 487 'Child', 'wptests_tax', array( 488 'parent' => $t2, 489 ) 490 ); 491 492 $error = wp_insert_term( 493 'Child', 'wptests_tax', array( 494 'parent' => $t2, 495 ) 496 ); 425 497 426 498 $this->assertWPError( $error ); … … 434 506 public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_hierarchical_taxonomy() { 435 507 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 436 $t1 = self::factory()->term->create( array( 437 'name' => 'Foo', 438 'slug' => 'foo', 439 'taxonomy' => 'wptests_tax', 440 ) ); 441 442 $t2 = wp_insert_term( 'Foo', 'wptests_tax', array( 443 'slug' => 'foo-unique', 444 ) ); 508 $t1 = self::factory()->term->create( 509 array( 510 'name' => 'Foo', 511 'slug' => 'foo', 512 'taxonomy' => 'wptests_tax', 513 ) 514 ); 515 516 $t2 = wp_insert_term( 517 'Foo', 'wptests_tax', array( 518 'slug' => 'foo-unique', 519 ) 520 ); 445 521 446 522 $this->assertNotWPError( $t2 ); … … 456 532 public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_hierarchical_taxonomy() { 457 533 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 458 $t1 = self::factory()->term->create( array( 459 'name' => 'Foo', 460 'slug' => 'foo', 461 'taxonomy' => 'wptests_tax', 462 ) ); 534 $t1 = self::factory()->term->create( 535 array( 536 'name' => 'Foo', 537 'slug' => 'foo', 538 'taxonomy' => 'wptests_tax', 539 ) 540 ); 463 541 464 542 $t2 = wp_insert_term( 'Foo', 'wptests_tax' ); … … 472 550 public function test_wp_insert_term_duplicate_slug_same_taxonomy() { 473 551 register_taxonomy( 'wptests_tax', 'post' ); 474 $t = self::factory()->term->create( array( 475 'name' => 'Foo', 476 'slug' => 'foo', 477 'taxonomy' => 'wptests_tax', 478 ) ); 552 $t = self::factory()->term->create( 553 array( 554 'name' => 'Foo', 555 'slug' => 'foo', 556 'taxonomy' => 'wptests_tax', 557 ) 558 ); 479 559 480 560 $term = get_term( $t, 'wptests_tax' ); 481 561 482 $created = wp_insert_term( 'Foo 2', 'wptests_tax', array( 483 'slug' => 'foo', 484 ) ); 562 $created = wp_insert_term( 563 'Foo 2', 'wptests_tax', array( 564 'slug' => 'foo', 565 ) 566 ); 485 567 486 568 $created_term = get_term( $created['term_id'], 'wptests_tax' ); … … 496 578 register_taxonomy( 'wptests_tax', 'post' ); 497 579 register_taxonomy( 'wptests_tax_2', 'post' ); 498 $t = self::factory()->term->create( array( 499 'name' => 'Foo', 500 'slug' => 'foo', 501 'taxonomy' => 'wptests_tax', 502 ) ); 580 $t = self::factory()->term->create( 581 array( 582 'name' => 'Foo', 583 'slug' => 'foo', 584 'taxonomy' => 'wptests_tax', 585 ) 586 ); 503 587 504 588 $term = get_term( $t, 'wptests_tax' ); 505 589 506 $created = wp_insert_term( 'Foo 2', 'wptests_tax_2', array( 507 'slug' => 'foo', 508 ) ); 590 $created = wp_insert_term( 591 'Foo 2', 'wptests_tax_2', array( 592 'slug' => 'foo', 593 ) 594 ); 509 595 510 596 $this->assertNotWPError( $created ); … … 526 612 register_taxonomy( 'wptests_tax', 'post' ); 527 613 register_taxonomy( 'wptests_tax_2', 'post' ); 528 $t = self::factory()->term->create( array( 529 'name' => 'Foo', 530 'slug' => 'foo', 531 'taxonomy' => 'wptests_tax', 532 ) ); 614 $t = self::factory()->term->create( 615 array( 616 'name' => 'Foo', 617 'slug' => 'foo', 618 'taxonomy' => 'wptests_tax', 619 ) 620 ); 533 621 534 622 $term = get_term( $t, 'wptests_tax' ); 535 623 536 $created = wp_insert_term( 'Foo 2', 'wptests_tax_2', array( 537 'slug' => 'foo', 538 ) ); 624 $created = wp_insert_term( 625 'Foo 2', 'wptests_tax_2', array( 626 'slug' => 'foo', 627 ) 628 ); 539 629 540 630 $this->assertNotWPError( $created ); … … 554 644 public function test_wp_insert_term_alias_of_no_term_group() { 555 645 register_taxonomy( 'wptests_tax', 'post' ); 556 $t1 = self::factory()->term->create( array( 557 'taxonomy' => 'wptests_tax', 558 ) ); 646 $t1 = self::factory()->term->create( 647 array( 648 'taxonomy' => 'wptests_tax', 649 ) 650 ); 559 651 $term_1 = get_term( $t1, 'wptests_tax' ); 560 652 561 $created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array( 562 'alias_of' => $term_1->slug, 563 ) ); 564 $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' ); 653 $created_term_ids = wp_insert_term( 654 'Foo', 'wptests_tax', array( 655 'alias_of' => $term_1->slug, 656 ) 657 ); 658 $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' ); 565 659 566 660 $updated_term_1 = get_term( $term_1->term_id, 'wptests_tax' ); … … 576 670 public function test_wp_insert_term_alias_of_existing_term_group() { 577 671 register_taxonomy( 'wptests_tax', 'post' ); 578 $t1 = self::factory()->term->create( array( 579 'taxonomy' => 'wptests_tax', 580 ) ); 672 $t1 = self::factory()->term->create( 673 array( 674 'taxonomy' => 'wptests_tax', 675 ) 676 ); 581 677 $term_1 = get_term( $t1, 'wptests_tax' ); 582 678 583 $t2 = self::factory()->term->create( array( 584 'taxonomy' => 'wptests_tax', 585 'alias_of' => $term_1->slug, 586 ) ); 679 $t2 = self::factory()->term->create( 680 array( 681 'taxonomy' => 'wptests_tax', 682 'alias_of' => $term_1->slug, 683 ) 684 ); 587 685 $term_2 = get_term( $t2, 'wptests_tax' ); 588 686 589 $created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array( 590 'alias_of' => $term_2->slug, 591 ) ); 592 $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' ); 687 $created_term_ids = wp_insert_term( 688 'Foo', 'wptests_tax', array( 689 'alias_of' => $term_2->slug, 690 ) 691 ); 692 $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' ); 593 693 _unregister_taxonomy( 'wptests_tax' ); 594 694 … … 599 699 public function test_wp_insert_term_alias_of_nonexistent_term() { 600 700 register_taxonomy( 'wptests_tax', 'post' ); 601 $created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array( 602 'alias_of' => 'foo', 603 ) ); 604 $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' ); 701 $created_term_ids = wp_insert_term( 702 'Foo', 'wptests_tax', array( 703 'alias_of' => 'foo', 704 ) 705 ); 706 $created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' ); 605 707 _unregister_taxonomy( 'wptests_tax' ); 606 708 … … 625 727 $found = wp_insert_term( 'foo', 'wptests_tax' ); 626 728 627 $term_by_id = get_term( $found['term_id'], 'wptests_tax' );729 $term_by_id = get_term( $found['term_id'], 'wptests_tax' ); 628 730 $term_by_slug = get_term_by( 'slug', 'foo', 'wptests_tax' ); 629 731 $term_by_ttid = get_term_by( 'term_taxonomy_id', $found['term_taxonomy_id'], 'wptests_tax' ); … … 640 742 641 743 public function test_wp_insert_term_should_clean_term_cache() { 642 register_taxonomy( 'wptests_tax', 'post', array( 643 'hierarchical' => true, 644 ) ); 645 646 $t = self::factory()->term->create( array( 647 'taxonomy' => 'wptests_tax', 648 ) ); 744 register_taxonomy( 745 'wptests_tax', 'post', array( 746 'hierarchical' => true, 747 ) 748 ); 749 750 $t = self::factory()->term->create( 751 array( 752 'taxonomy' => 'wptests_tax', 753 ) 754 ); 649 755 650 756 /** … … 657 763 wp_cache_set( 'get', array( 1, 2, 3 ), 'wptests_tax' ); 658 764 659 $found = wp_insert_term( 'foo', 'wptests_tax', array( 660 'parent' => $t, 661 ) ); 765 $found = wp_insert_term( 766 'foo', 'wptests_tax', array( 767 'parent' => $t, 768 ) 769 ); 662 770 _unregister_taxonomy( 'wptests_tax' ); 663 771 … … 676 784 register_taxonomy( 'wptests_tax', 'post' ); 677 785 678 $t1 = self::factory()->term->create( array( 679 'name' => 'Foó', 680 'taxonomy' => 'wptests_tax', 681 ) ); 682 $t2 = self::factory()->term->create( array( 683 'name' => 'Foo', 684 'taxonomy' => 'wptests_tax', 685 ) ); 786 $t1 = self::factory()->term->create( 787 array( 788 'name' => 'Foó', 789 'taxonomy' => 'wptests_tax', 790 ) 791 ); 792 $t2 = self::factory()->term->create( 793 array( 794 'name' => 'Foo', 795 'taxonomy' => 'wptests_tax', 796 ) 797 ); 686 798 687 799 $this->assertInternalType( 'int', $t1 ); … … 701 813 register_taxonomy( 'wptests_tax', 'post' ); 702 814 703 $t1 = self::factory()->term->create( array( 704 'name' => 'Foo#bar', 705 'taxonomy' => 'wptests_tax', 706 ) ); 815 $t1 = self::factory()->term->create( 816 array( 817 'name' => 'Foo#bar', 818 'taxonomy' => 'wptests_tax', 819 ) 820 ); 707 821 708 822 $created = wp_insert_term( 'Foo$bar', 'wptests_tax' ); … … 722 836 register_taxonomy( 'wptests_tax', 'post' ); 723 837 724 $term = wp_insert_term( 'foo', 'wptests_tax', array( 725 'description' => null 726 ) ); 838 $term = wp_insert_term( 839 'foo', 'wptests_tax', array( 840 'description' => null, 841 ) 842 ); 727 843 728 844 $term_object = get_term( $term['term_id'] ); … … 732 848 } 733 849 734 /** Helpers * *********************************************************/850 /** Helpers */ 735 851 736 852 public function deleted_term_cb( $term, $tt_id, $taxonomy, $deleted_term, $object_ids ) {
Note: See TracChangeset
for help on using the changeset viewer.