Changeset 42343 for trunk/tests/phpunit/tests/term/wpUniqueTermSlug.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/wpUniqueTermSlug.php
r35242 r42343 12 12 13 13 public function test_unique_slug_should_be_unchanged() { 14 $term = self::factory()->term->create_and_get( array( 15 'taxonomy' => 'wptests_tax1', 16 'name' => 'foo', 17 'slug' => 'foo', 18 ) ); 14 $term = self::factory()->term->create_and_get( 15 array( 16 'taxonomy' => 'wptests_tax1', 17 'name' => 'foo', 18 'slug' => 'foo', 19 ) 20 ); 19 21 20 22 $actual = wp_unique_term_slug( 'bar', $term ); … … 23 25 24 26 public function test_nonunique_slug_in_different_taxonomy_should_be_unchanged() { 25 $term1 = self::factory()->term->create( array( 26 'taxonomy' => 'wptests_tax2', 27 'name' => 'bar', 28 'slug' => 'bar', 29 ) ); 27 $term1 = self::factory()->term->create( 28 array( 29 'taxonomy' => 'wptests_tax2', 30 'name' => 'bar', 31 'slug' => 'bar', 32 ) 33 ); 30 34 31 $term2 = self::factory()->term->create( array( 32 'taxonomy' => 'wptests_tax1', 33 'name' => 'foo', 34 'slug' => 'foo', 35 ) ); 35 $term2 = self::factory()->term->create( 36 array( 37 'taxonomy' => 'wptests_tax1', 38 'name' => 'foo', 39 'slug' => 'foo', 40 ) 41 ); 36 42 $term2_object = get_term( $term2, 'wptests_tax1' ); 37 43 … … 41 47 42 48 public function test_nonunique_slug_in_same_nonhierarchical_taxonomy_should_be_changed() { 43 $term1 = self::factory()->term->create( array( 44 'taxonomy' => 'wptests_tax1', 45 'name' => 'bar', 46 'slug' => 'bar', 47 ) ); 49 $term1 = self::factory()->term->create( 50 array( 51 'taxonomy' => 'wptests_tax1', 52 'name' => 'bar', 53 'slug' => 'bar', 54 ) 55 ); 48 56 49 $term2 = self::factory()->term->create( array( 50 'taxonomy' => 'wptests_tax1', 51 'name' => 'foo', 52 'slug' => 'foo', 53 ) ); 57 $term2 = self::factory()->term->create( 58 array( 59 'taxonomy' => 'wptests_tax1', 60 'name' => 'foo', 61 'slug' => 'foo', 62 ) 63 ); 54 64 $term2_object = get_term( $term2, 'wptests_tax1' ); 55 65 … … 59 69 60 70 public function test_nonunique_slug_in_same_hierarchical_taxonomy_with_same_parent_should_be_suffixed_with_parent_slug() { 61 $parent = self::factory()->term->create( array( 62 'taxonomy' => 'wptests_tax2', 63 'slug' => 'parent-term', 64 ) ); 71 $parent = self::factory()->term->create( 72 array( 73 'taxonomy' => 'wptests_tax2', 74 'slug' => 'parent-term', 75 ) 76 ); 65 77 66 $term1 = self::factory()->term->create( array( 67 'taxonomy' => 'wptests_tax2', 68 'name' => 'bar', 69 'slug' => 'bar', 70 'parent' => $parent, 71 ) ); 78 $term1 = self::factory()->term->create( 79 array( 80 'taxonomy' => 'wptests_tax2', 81 'name' => 'bar', 82 'slug' => 'bar', 83 'parent' => $parent, 84 ) 85 ); 72 86 73 $term2 = self::factory()->term->create( array( 74 'taxonomy' => 'wptests_tax2', 75 'name' => 'foo', 76 'slug' => 'foo', 77 'parent' => $parent, 78 ) ); 87 $term2 = self::factory()->term->create( 88 array( 89 'taxonomy' => 'wptests_tax2', 90 'name' => 'foo', 91 'slug' => 'foo', 92 'parent' => $parent, 93 ) 94 ); 79 95 $term2_object = get_term( $term2, 'wptests_tax2' ); 80 96 … … 84 100 85 101 public function test_nonunique_slug_in_same_hierarchical_taxonomy_at_different_level_of_hierarchy_should_be_suffixed_with_number() { 86 $parent = self::factory()->term->create( array( 87 'taxonomy' => 'wptests_tax2', 88 'slug' => 'parent-term', 89 ) ); 102 $parent = self::factory()->term->create( 103 array( 104 'taxonomy' => 'wptests_tax2', 105 'slug' => 'parent-term', 106 ) 107 ); 90 108 91 $term1 = self::factory()->term->create( array( 92 'taxonomy' => 'wptests_tax2', 93 'name' => 'bar', 94 'slug' => 'bar', 95 'parent' => $parent, 96 ) ); 109 $term1 = self::factory()->term->create( 110 array( 111 'taxonomy' => 'wptests_tax2', 112 'name' => 'bar', 113 'slug' => 'bar', 114 'parent' => $parent, 115 ) 116 ); 97 117 98 $term2 = self::factory()->term->create( array( 99 'taxonomy' => 'wptests_tax2', 100 'name' => 'foo', 101 'slug' => 'foo', 102 ) ); 118 $term2 = self::factory()->term->create( 119 array( 120 'taxonomy' => 'wptests_tax2', 121 'name' => 'foo', 122 'slug' => 'foo', 123 ) 124 ); 103 125 $term2_object = get_term( $term2, 'wptests_tax2' ); 104 126
Note: See TracChangeset
for help on using the changeset viewer.