Changeset 53369 for branches/6.0/tests/phpunit/tests/taxonomy.php
- Timestamp:
- 05/09/2022 12:51:18 AM (3 years ago)
- Location:
- branches/6.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0
-
branches/6.0/tests/phpunit/tests/taxonomy.php
r53126 r53369 240 240 241 241 /** 242 * @ticket 49701 243 * 244 * @covers ::get_inline_data 245 */ 246 public function test_get_inline_data_contains_term_if_show_ui_false_but_show_on_quick_edit_true_for_hierarchical_taxonomy() { 247 // Create a post with a term from a hierarchical taxonomy. 248 register_taxonomy( 249 'wptests_tax_1', 250 'post', 251 array( 252 'show_ui' => false, 253 'show_in_quick_edit' => true, 254 'hierarchical' => true, 255 ) 256 ); 257 $term = wp_insert_term( 'Test', 'wptests_tax_1' ); 258 $post = self::factory()->post->create_and_get(); 259 wp_set_object_terms( $post->ID, $term['term_id'], 'wptests_tax_1' ); 260 261 // Test get_inline_data() has post_category div containing assigned term. 262 wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 263 get_inline_data( $post ); 264 $this->expectOutputRegex( '/<div class="post_category" id="wptests_tax_1_' . $post->ID . '">' . $term['term_id'] . '<\/div>/' ); 265 } 266 267 /** 268 * @ticket 49701 269 * 270 * @covers ::get_inline_data 271 */ 272 public function test_get_inline_data_contains_term_if_show_ui_false_but_show_on_quick_edit_true_for_nonhierarchical_taxonomy() { 273 // Create a post with a term from a hierarchical taxonomy. 274 register_taxonomy( 275 'wptests_tax_1', 276 'post', 277 array( 278 'show_ui' => false, 279 'show_in_quick_edit' => true, 280 'hierarchical' => false, 281 ) 282 ); 283 $term = wp_insert_term( 'Test', 'wptests_tax_1' ); 284 $post = self::factory()->post->create_and_get(); 285 wp_set_object_terms( $post->ID, $term['term_id'], 'wptests_tax_1' ); 286 287 // Test get_inline_data() has tags_input div containing assigned term. 288 wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 289 get_inline_data( $post ); 290 $this->expectOutputRegex( '/<div class="tags_input" id="wptests_tax_1_' . $post->ID . '">Test<\/div>/' ); 291 } 292 293 /** 242 294 * @ticket 11058 243 295 */
Note: See TracChangeset
for help on using the changeset viewer.