Changeset 42343 for trunk/tests/phpunit/tests/term/getTermLink.php
- Timestamp:
- 11/30/2017 11:09:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/getTermLink.php
r35242 r42343 13 13 14 14 public function test_integer_should_be_interpreted_as_term_id() { 15 $t1 = self::factory()->term->create( array( 16 'taxonomy' => 'wptests_tax', 17 'name' => 'foo', 18 ) ); 19 $t2 = self::factory()->term->create( array( 20 'taxonomy' => 'wptests_tax', 21 'slug' => $t1, 22 ) ); 15 $t1 = self::factory()->term->create( 16 array( 17 'taxonomy' => 'wptests_tax', 18 'name' => 'foo', 19 ) 20 ); 21 $t2 = self::factory()->term->create( 22 array( 23 'taxonomy' => 'wptests_tax', 24 'slug' => $t1, 25 ) 26 ); 23 27 24 28 $term = intval( $t1 ); … … 29 33 30 34 public function test_numeric_string_should_be_interpreted_as_term_slug() { 31 $t1 = self::factory()->term->create( array( 32 'taxonomy' => 'wptests_tax', 33 'name' => 'foo', 34 ) ); 35 $t2 = self::factory()->term->create( array( 36 'taxonomy' => 'wptests_tax', 37 'slug' => $t1, 38 ) ); 35 $t1 = self::factory()->term->create( 36 array( 37 'taxonomy' => 'wptests_tax', 38 'name' => 'foo', 39 ) 40 ); 41 $t2 = self::factory()->term->create( 42 array( 43 'taxonomy' => 'wptests_tax', 44 'slug' => $t1, 45 ) 46 ); 39 47 40 48 $term = (string) $t1; … … 57 65 58 66 public function test_taxonomy_with_query_var_should_use_that_query_var_with_term_slug() { 59 register_taxonomy( 'wptests_tax2', 'post', array( 60 'query_var' => 'foo', 61 ) ); 67 register_taxonomy( 68 'wptests_tax2', 'post', array( 69 'query_var' => 'foo', 70 ) 71 ); 62 72 63 $t = self::factory()->term->create( array( 64 'taxonomy' => 'wptests_tax2', 65 'slug' => 'bar', 66 ) ); 73 $t = self::factory()->term->create( 74 array( 75 'taxonomy' => 'wptests_tax2', 76 'slug' => 'bar', 77 ) 78 ); 67 79 68 80 $actual = get_term_link( $t, 'wptests_tax2' ); … … 71 83 72 84 public function test_taxonomy_without_query_var_should_use_taxonomy_query_var_and_term_query_var_with_term_slug() { 73 register_taxonomy( 'wptests_tax2', 'post', array( 74 'query_var' => false, 75 ) ); 85 register_taxonomy( 86 'wptests_tax2', 'post', array( 87 'query_var' => false, 88 ) 89 ); 76 90 77 $t = self::factory()->term->create( array( 78 'taxonomy' => 'wptests_tax2', 79 'slug' => 'bar', 80 ) ); 91 $t = self::factory()->term->create( 92 array( 93 'taxonomy' => 'wptests_tax2', 94 'slug' => 'bar', 95 ) 96 ); 81 97 82 98 $actual = get_term_link( $t, 'wptests_tax2' ); … … 88 104 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 89 105 90 register_taxonomy( 'wptests_tax2', 'post', array( 91 'hierarchical' => true, 92 'rewrite' => array( 93 'slug' => 'foo', 106 register_taxonomy( 107 'wptests_tax2', 'post', array( 94 108 'hierarchical' => true, 95 ), 96 ) ); 109 'rewrite' => array( 110 'slug' => 'foo', 111 'hierarchical' => true, 112 ), 113 ) 114 ); 97 115 98 116 flush_rewrite_rules(); 99 117 100 $t1 = self::factory()->term->create( array( 101 'taxonomy' => 'wptests_tax2', 102 'slug' => 'term1', 103 ) ); 118 $t1 = self::factory()->term->create( 119 array( 120 'taxonomy' => 'wptests_tax2', 121 'slug' => 'term1', 122 ) 123 ); 104 124 105 $t2 = self::factory()->term->create( array( 106 'taxonomy' => 'wptests_tax2', 107 'slug' => 'term2', 108 'parent' => $t1, 109 ) ); 125 $t2 = self::factory()->term->create( 126 array( 127 'taxonomy' => 'wptests_tax2', 128 'slug' => 'term2', 129 'parent' => $t1, 130 ) 131 ); 110 132 111 133 $actual = get_term_link( $t2, 'wptests_tax2' ); … … 117 139 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 118 140 119 register_taxonomy( 'wptests_tax2', 'post', array( 120 'hierarchical' => true, 121 'rewrite' => array( 122 'slug' => 'foo', 123 'hierarchical' => false, 124 ), 125 ) ); 141 register_taxonomy( 142 'wptests_tax2', 'post', array( 143 'hierarchical' => true, 144 'rewrite' => array( 145 'slug' => 'foo', 146 'hierarchical' => false, 147 ), 148 ) 149 ); 126 150 127 151 flush_rewrite_rules(); 128 152 129 $t1 = self::factory()->term->create( array( 130 'taxonomy' => 'wptests_tax2', 131 'slug' => 'term1', 132 ) ); 153 $t1 = self::factory()->term->create( 154 array( 155 'taxonomy' => 'wptests_tax2', 156 'slug' => 'term1', 157 ) 158 ); 133 159 134 $t2 = self::factory()->term->create( array( 135 'taxonomy' => 'wptests_tax2', 136 'slug' => 'term2', 137 'parent' => $t1, 138 ) ); 160 $t2 = self::factory()->term->create( 161 array( 162 'taxonomy' => 'wptests_tax2', 163 'slug' => 'term2', 164 'parent' => $t1, 165 ) 166 ); 139 167 140 168 $actual = get_term_link( $t2, 'wptests_tax2' );
Note: See TracChangeset
for help on using the changeset viewer.