Ticket #36224: 36224.2.diff
File 36224.2.diff, 21.5 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php index 34d179c..2effada 100644
function wp_ajax_ajax_tag_search() { 136 136 * 137 137 * @since 4.0.0 138 138 * 139 * @param int $characters The minimum number of characters required. Default 2.140 * @param object$tax The taxonomy object.141 * @param string $s The search term.139 * @param int $characters The minimum number of characters required. Default 2. 140 * @param WP_Taxonomy $tax The taxonomy object. 141 * @param string $s The search term. 142 142 */ 143 143 $term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $s ); 144 144 -
new file src/wp-includes/class-wp-taxonomy.php
diff --git src/wp-includes/class-wp-taxonomy.php src/wp-includes/class-wp-taxonomy.php new file mode 100644 index 0000000..45f9f6e
- + 1 <?php 2 /** 3 * Taxonomy API: WP_Taxonomy class 4 * 5 * @package WordPress 6 * @subpackage Taxonomy 7 * @since 4.6.0 8 */ 9 10 /** 11 * Core class used for interacting with taxonomies. 12 * 13 * @since 4.6.0 14 */ 15 final class WP_Taxonomy implements ArrayAccess { 16 /** 17 * Taxonomy key. 18 * 19 * @since 4.6.0 20 * @access public 21 * @var string 22 */ 23 public $name; 24 25 /** 26 * Name of the taxonomy shown in the menu. Usually plural. 27 * 28 * @since 4.6.0 29 * @access public 30 * @var string 31 */ 32 public $label; 33 34 /** 35 * An array of labels for this taxonomy. 36 * 37 * @since 4.6.0 38 * @access public 39 * @var array 40 */ 41 public $labels = array(); 42 43 /** 44 * A short descriptive summary of what the taxonomy is for. 45 * 46 * @since 4.6.0 47 * @access public 48 * @var string 49 */ 50 public $description = ''; 51 52 /** 53 * Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users. 54 * 55 * @since 4.6.0 56 * @access public 57 * @var bool 58 */ 59 public $public = true; 60 61 /** 62 * Whether the taxonomy is publicly queryable. 63 * 64 * @since 4.6.0 65 * @access public 66 * @var bool 67 */ 68 public $publicly_queryable = true; 69 70 /** 71 * Whether the taxonomy is hierarchical. 72 * 73 * @since 4.6.0 74 * @access public 75 * @var bool 76 */ 77 public $hierarchical = false; 78 79 /** 80 * Whether to generate and allow a UI for managing terms in this taxonomy in the admin. 81 * 82 * @since 4.6.0 83 * @access public 84 * @var bool 85 */ 86 public $show_ui = true; 87 88 /** 89 * Whether to show the taxonomy in the admin menu. 90 * 91 * If true, the taxonomy is shown as a submenu of the object type menu. If false, no menu is shown. 92 * 93 * @since 4.6.0 94 * @access public 95 * @var bool 96 */ 97 public $show_in_menu = true; 98 99 /** 100 * Whether the taxonomy is available for selection in navigation menus. 101 * 102 * @since 4.6.0 103 * @access public 104 * @var bool 105 */ 106 public $show_in_nav_menus = true; 107 108 /** 109 * Whether to list the taxonomy in the tag cloud widget controls. 110 * 111 * @since 4.6.0 112 * @access public 113 * @var bool 114 */ 115 public $show_tagcloud = true; 116 117 /** 118 * Whether to show the taxonomy in the quick/bulk edit panel. 119 * 120 * @since 4.6.0 121 * @access public 122 * @var bool 123 */ 124 public $show_in_quick_edit = true; 125 126 /** 127 * Whether to display a column for the taxonomy on its post type listing screens. 128 * 129 * @since 4.6.0 130 * @access public 131 * @var bool 132 */ 133 public $show_admin_column = false; 134 135 /** 136 * The callback function for the meta box display. 137 * 138 * @since 4.6.0 139 * @access public 140 * @var bool|callable 141 */ 142 public $meta_box_cb = null; 143 144 /** 145 * An array of object types this taxonomy is registered for. 146 * 147 * @since 4.6.0 148 * @access public 149 * @var array 150 */ 151 public $object_type = null; 152 153 /** 154 * Capabilities for this taxonomy. 155 * 156 * @since 4.6.0 157 * @access public 158 * @var array 159 */ 160 public $cap; 161 162 /** 163 * Rewrites information for this taxonomy. 164 * 165 * @since 4.6.0 166 * @access public 167 * @var array|false 168 */ 169 public $rewrite; 170 171 /** 172 * Query var string for this taxonomy. 173 * 174 * @since 4.6.0 175 * @access public 176 * @var string|false 177 */ 178 public $query_var; 179 180 /** 181 * Function that will be called when the count is updated. 182 * 183 * @since 4.6.0 184 * @access public 185 * @var callable 186 */ 187 public $update_count_callback; 188 189 /** 190 * Whether it is a built-in taxonomy. 191 * 192 * @since 4.6.0 193 * @access public 194 * @var bool 195 */ 196 public $_builtin; 197 198 /** 199 * Constructor. 200 * 201 * @since 4.6.0 202 * @access public 203 * 204 * @global WP $wp WP instance. 205 * 206 * @param string $taxonomy Taxonomy key, must not exceed 32 characters. 207 * @param array|string $object_type Name of the object type for the taxonomy object. 208 * @param array|string $args { 209 * Optional. Array or query string of arguments for registering a taxonomy. 210 */ 211 public function __construct( $taxonomy, $object_type, $args ) { 212 global $wp; 213 214 $args = wp_parse_args( $args ); 215 216 /** 217 * Filter the arguments for registering a taxonomy. 218 * 219 * @since 4.4.0 220 * 221 * @param array $args Array of arguments for registering a taxonomy. 222 * @param string $taxonomy Taxonomy key. 223 * @param array $object_type Array of names of object types for the taxonomy. 224 */ 225 $args = apply_filters( 'register_taxonomy_args', $args, $taxonomy, (array) $object_type ); 226 227 $defaults = array( 228 'labels' => array(), 229 'description' => '', 230 'public' => true, 231 'publicly_queryable' => null, 232 'hierarchical' => false, 233 'show_ui' => null, 234 'show_in_menu' => null, 235 'show_in_nav_menus' => null, 236 'show_tagcloud' => null, 237 'show_in_quick_edit' => null, 238 'show_admin_column' => false, 239 'meta_box_cb' => null, 240 'capabilities' => array(), 241 'rewrite' => true, 242 'query_var' => $taxonomy, 243 'update_count_callback' => '', 244 '_builtin' => false, 245 ); 246 $args = array_merge( $defaults, $args ); 247 248 // If not set, default to the setting for public. 249 if ( null === $args['publicly_queryable'] ) { 250 $args['publicly_queryable'] = $args['public']; 251 } 252 253 // Non-publicly queryable taxonomies should not register query vars, except in the admin. 254 if ( false !== $args['query_var'] && ( is_admin() || false !== $args['publicly_queryable'] ) && ! empty( $wp ) ) { 255 if ( true === $args['query_var'] ) { 256 $args['query_var'] = $taxonomy; 257 } else { 258 $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); 259 } 260 $wp->add_query_var( $args['query_var'] ); 261 } else { 262 // Force query_var to false for non-public taxonomies. 263 $args['query_var'] = false; 264 } 265 266 if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { 267 $args['rewrite'] = wp_parse_args( $args['rewrite'], array( 268 'with_front' => true, 269 'hierarchical' => false, 270 'ep_mask' => EP_NONE, 271 ) ); 272 273 if ( empty( $args['rewrite']['slug'] ) ) { 274 $args['rewrite']['slug'] = sanitize_title_with_dashes( $taxonomy ); 275 } 276 277 if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] ) { 278 $tag = '(.+?)'; 279 } else { 280 $tag = '([^/]+)'; 281 } 282 283 add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" ); 284 add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] ); 285 } 286 287 // If not set, default to the setting for public. 288 if ( null === $args['show_ui'] ) { 289 $args['show_ui'] = $args['public']; 290 } 291 292 // If not set, default to the setting for show_ui. 293 if ( null === $args['show_in_menu'] || ! $args['show_ui'] ) { 294 $args['show_in_menu'] = $args['show_ui']; 295 } 296 297 // If not set, default to the setting for public. 298 if ( null === $args['show_in_nav_menus'] ) { 299 $args['show_in_nav_menus'] = $args['public']; 300 } 301 302 // If not set, default to the setting for show_ui. 303 if ( null === $args['show_tagcloud'] ) { 304 $args['show_tagcloud'] = $args['show_ui']; 305 } 306 307 // If not set, default to the setting for show_ui. 308 if ( null === $args['show_in_quick_edit'] ) { 309 $args['show_in_quick_edit'] = $args['show_ui']; 310 } 311 312 $default_caps = array( 313 'manage_terms' => 'manage_categories', 314 'edit_terms' => 'manage_categories', 315 'delete_terms' => 'manage_categories', 316 'assign_terms' => 'edit_posts', 317 ); 318 $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] ); 319 unset( $args['capabilities'] ); 320 321 $args['name'] = $taxonomy; 322 $args['object_type'] = array_unique( (array) $object_type ); 323 324 $args['labels'] = get_taxonomy_labels( (object) $args ); 325 $args['label'] = $args['labels']->name; 326 327 // If not set, use the default meta box 328 if ( null === $args['meta_box_cb'] ) { 329 if ( $args['hierarchical'] ) { 330 $args['meta_box_cb'] = 'post_categories_meta_box'; 331 } else { 332 $args['meta_box_cb'] = 'post_tags_meta_box'; 333 } 334 } 335 336 foreach ( $args as $key => $value ) { 337 $this->$key = $value; 338 } 339 } 340 341 /** 342 * Retrieves the taxonomy object of `$taxonomy`. 343 * 344 * @since 4.6.0 345 * @access public 346 * @static 347 * 348 * @global array $wp_taxonomies The registered taxonomies. 349 * 350 * @param string $taxonomy Name of taxonomy object to return. 351 * @return WP_Taxonomy|false The Taxonomy object or false if taxonomy does not exist. 352 */ 353 public static function get_instance( $taxonomy ) { 354 global $wp_taxonomies; 355 356 if ( ! taxonomy_exists( $taxonomy ) ) 357 return false; 358 359 return $wp_taxonomies[$taxonomy]; 360 } 361 362 /** 363 * Method to implement ArrayAccess for taxonomy arguments. 364 * 365 * @since 4.6.0 366 * @access public 367 * 368 * @param mixed $offset 369 * @param mixed $value 370 */ 371 public function offsetSet( $offset, $value ) { 372 if ( $this->offsetExists( $offset ) ) { 373 $this->$offset = $value; 374 } 375 } 376 377 /** 378 * Method to implement ArrayAccess for taxonomy arguments. 379 * 380 * @since 4.6.0 381 * @access public 382 * 383 * @param mixed $offset 384 */ 385 public function offsetUnset( $offset ) { 386 if ( $this->offsetExists( $offset ) ) { 387 unset( $this->$offset ); 388 } 389 } 390 391 /** 392 * Method to implement ArrayAccess for taxonomy arguments. 393 * 394 * @since 4.6.0 395 * @access public 396 * 397 * @param mixed $offset 398 * @return bool 399 */ 400 public function offsetExists( $offset ) { 401 return property_exists( $this, $offset ); 402 } 403 404 /** 405 * Method to implement ArrayAccess for taxonomy arguments. 406 * 407 * @since 4.6.0 408 * @access public 409 * 410 * @param mixed $offset 411 * @return mixed 412 */ 413 public function offsetGet( $offset ) { 414 if ( $this->offsetExists( $offset ) ) { 415 return $this->$offset; 416 } 417 } 418 } -
src/wp-includes/class-wp-xmlrpc-server.php
diff --git src/wp-includes/class-wp-xmlrpc-server.php src/wp-includes/class-wp-xmlrpc-server.php index c331591..7058f51 100644
class wp_xmlrpc_server extends IXR_Server { 695 695 * 696 696 * @since 3.4.0 697 697 * 698 * @param array $_taxonomy An array of taxonomy data.699 * @param object$taxonomy Taxonomy object.700 * @param array $fields The subset of taxonomy fields to return.698 * @param array $_taxonomy An array of taxonomy data. 699 * @param WP_Taxonomy $taxonomy Taxonomy object. 700 * @param array $fields The subset of taxonomy fields to return. 701 701 */ 702 702 return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields ); 703 703 } -
src/wp-includes/link-template.php
diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php index 11c4e40..c6a24f9 100644
function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) { 922 922 } 923 923 924 924 $tax = get_taxonomy( $term->taxonomy ); 925 var_dump($term->taxonomy,$tax->cap,current_user_can( $tax->cap->edit_terms ) ); 925 926 if ( ! $tax || ! current_user_can( $tax->cap->edit_terms ) ) { 926 927 return; 927 928 } -
src/wp-includes/taxonomy.php
diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php index 8fad3d9..93547fb 100644
function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) 162 162 * Example: 163 163 * 164 164 * $taxonomies = get_object_taxonomies( 'post' ); 165 * 165 * 166 166 * This results in: 167 * 167 * 168 168 * Array( 'category', 'post_tag' ) 169 169 * 170 170 * @since 2.3.0 … … function get_object_taxonomies( $object, $output = 'names' ) { 208 208 * 209 209 * @since 2.3.0 210 210 * 211 * @global array $wp_taxonomies The registered taxonomies.212 *213 211 * @param string $taxonomy Name of taxonomy object to return. 214 * @return object|false The Taxonomy Object or false if $taxonomy doesn't exist.212 * @return WP_Taxonomy|false The Taxonomy object or false if taxonomy does not exist. 215 213 */ 216 214 function get_taxonomy( $taxonomy ) { 217 global $wp_taxonomies; 218 219 if ( ! taxonomy_exists( $taxonomy ) ) 220 return false; 221 222 return $wp_taxonomies[$taxonomy]; 215 return WP_Taxonomy::get_instance( $taxonomy ); 223 216 } 224 217 225 218 /** … … function is_taxonomy_hierarchical($taxonomy) { 276 269 * @since 4.4.0 The `show_ui` argument is now enforced on the term editing screen. 277 270 * @since 4.4.0 The `public` argument now controls whether the taxonomy can be queried on the front end. 278 271 * @since 4.5.0 Introduced `publicly_queryable` argument. 272 * @since 4.6.0 The function now returns the registered taxonomy object on success. 279 273 * 280 274 * @global array $wp_taxonomies Registered taxonomies. 281 * @global WP $wp WP instance.282 275 * 283 276 * @param string $taxonomy Taxonomy key, must not exceed 32 characters. 284 277 * @param array|string $object_type Name of the object type for the taxonomy object. … … function is_taxonomy_hierarchical($taxonomy) { 346 339 * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! 347 340 * Default false. 348 341 * } 349 * @return WP_ Error|void WP_Error, if errors.342 * @return WP_Taxonomy|WP_Error The registered taxonomy object, or an error object. 350 343 */ 351 344 function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 352 global $wp_taxonomies , $wp;345 global $wp_taxonomies; 353 346 354 if ( ! is_array( $wp_taxonomies ) ) 347 if ( ! is_array( $wp_taxonomies ) ) { 355 348 $wp_taxonomies = array(); 356 357 $args = wp_parse_args( $args ); 358 359 /** 360 * Filter the arguments for registering a taxonomy. 361 * 362 * @since 4.4.0 363 * 364 * @param array $args Array of arguments for registering a taxonomy. 365 * @param string $taxonomy Taxonomy key. 366 * @param array $object_type Array of names of object types for the taxonomy. 367 */ 368 $args = apply_filters( 'register_taxonomy_args', $args, $taxonomy, (array) $object_type ); 369 370 $defaults = array( 371 'labels' => array(), 372 'description' => '', 373 'public' => true, 374 'publicly_queryable' => null, 375 'hierarchical' => false, 376 'show_ui' => null, 377 'show_in_menu' => null, 378 'show_in_nav_menus' => null, 379 'show_tagcloud' => null, 380 'show_in_quick_edit' => null, 381 'show_admin_column' => false, 382 'meta_box_cb' => null, 383 'capabilities' => array(), 384 'rewrite' => true, 385 'query_var' => $taxonomy, 386 'update_count_callback' => '', 387 '_builtin' => false, 388 ); 389 $args = array_merge( $defaults, $args ); 349 } 390 350 391 351 if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) { 392 352 _doing_it_wrong( __FUNCTION__, __( 'Taxonomy names must be between 1 and 32 characters in length.' ), '4.2' ); 393 353 return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) ); 394 354 } 395 355 396 // If not set, default to the setting for public. 397 if ( null === $args['publicly_queryable'] ) { 398 $args['publicly_queryable'] = $args['public']; 399 } 356 $taxonomy_object = new WP_Taxonomy( $taxonomy, $object_type, $args ); 400 357 401 // Non-publicly queryable taxonomies should not register query vars, except in the admin. 402 if ( false !== $args['query_var'] && ( is_admin() || false !== $args['publicly_queryable'] ) && ! empty( $wp ) ) { 403 if ( true === $args['query_var'] ) 404 $args['query_var'] = $taxonomy; 405 else 406 $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); 407 $wp->add_query_var( $args['query_var'] ); 408 } else { 409 // Force query_var to false for non-public taxonomies. 410 $args['query_var'] = false; 411 } 412 413 if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { 414 $args['rewrite'] = wp_parse_args( $args['rewrite'], array( 415 'with_front' => true, 416 'hierarchical' => false, 417 'ep_mask' => EP_NONE, 418 ) ); 419 420 if ( empty( $args['rewrite']['slug'] ) ) 421 $args['rewrite']['slug'] = sanitize_title_with_dashes( $taxonomy ); 422 423 if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] ) 424 $tag = '(.+?)'; 425 else 426 $tag = '([^/]+)'; 427 428 add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" ); 429 add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] ); 430 } 431 432 // If not set, default to the setting for public. 433 if ( null === $args['show_ui'] ) 434 $args['show_ui'] = $args['public']; 435 436 // If not set, default to the setting for show_ui. 437 if ( null === $args['show_in_menu' ] || ! $args['show_ui'] ) 438 $args['show_in_menu' ] = $args['show_ui']; 439 440 // If not set, default to the setting for public. 441 if ( null === $args['show_in_nav_menus'] ) 442 $args['show_in_nav_menus'] = $args['public']; 443 444 // If not set, default to the setting for show_ui. 445 if ( null === $args['show_tagcloud'] ) 446 $args['show_tagcloud'] = $args['show_ui']; 358 $wp_taxonomies[ $taxonomy ] = $taxonomy_object; 447 359 448 // If not set, default to the setting for show_ui. 449 if ( null === $args['show_in_quick_edit'] ) { 450 $args['show_in_quick_edit'] = $args['show_ui']; 451 } 452 453 $default_caps = array( 454 'manage_terms' => 'manage_categories', 455 'edit_terms' => 'manage_categories', 456 'delete_terms' => 'manage_categories', 457 'assign_terms' => 'edit_posts', 458 ); 459 $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] ); 460 unset( $args['capabilities'] ); 461 462 $args['name'] = $taxonomy; 463 $args['object_type'] = array_unique( (array) $object_type ); 464 465 $args['labels'] = get_taxonomy_labels( (object) $args ); 466 $args['label'] = $args['labels']->name; 467 468 // If not set, use the default meta box 469 if ( null === $args['meta_box_cb'] ) { 470 if ( $args['hierarchical'] ) 471 $args['meta_box_cb'] = 'post_categories_meta_box'; 472 else 473 $args['meta_box_cb'] = 'post_tags_meta_box'; 474 } 475 476 $wp_taxonomies[ $taxonomy ] = (object) $args; 477 478 // register callback handling for metabox 360 // Register callback handling for metabox. 479 361 add_filter( 'wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term' ); 480 362 481 363 /** … … function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 483 365 * 484 366 * @since 3.3.0 485 367 * 486 * @param string $taxonomy Taxonomy slug.487 * @param array|string $object_type Object type or array of object types.488 * @param array $args Array of taxonomy registration arguments.368 * @param string $taxonomy Taxonomy slug. 369 * @param array|string $object_type Object type or array of object types. 370 * @param WP_Taxonomy $taxonomy_object The registered taxonomy object. 489 371 */ 490 do_action( 'registered_taxonomy', $taxonomy, $object_type, $args ); 372 do_action( 'registered_taxonomy', $taxonomy, $object_type, $taxonomy_object ); 373 374 return $taxonomy_object; 491 375 } 492 376 493 377 /** … … function unregister_taxonomy( $taxonomy ) { 579 463 * @since 4.3.0 Added the `no_terms` label. 580 464 * @since 4.4.0 Added the `items_list_navigation` and `items_list` labels. 581 465 * 582 * @param object $taxTaxonomy object.466 * @param object|WP_Taxonomy $tax Custom-something object or WP_Taxonomy object. 583 467 * @return object object with all the labels as member variables. 584 468 */ 585 469 function get_taxonomy_labels( $tax ) { -
src/wp-settings.php
diff --git src/wp-settings.php src/wp-settings.php index a4bb370..d7ecfc3 100644
require( ABSPATH . WPINC . '/cron.php' ); 166 166 require( ABSPATH . WPINC . '/deprecated.php' ); 167 167 require( ABSPATH . WPINC . '/script-loader.php' ); 168 168 require( ABSPATH . WPINC . '/taxonomy.php' ); 169 require( ABSPATH . WPINC . '/class-wp-taxonomy.php' ); 169 170 require( ABSPATH . WPINC . '/class-wp-term.php' ); 170 171 require( ABSPATH . WPINC . '/class-wp-tax-query.php' ); 171 172 require( ABSPATH . WPINC . '/update.php' ); -
new file tests/phpunit/tests/term/wpTaxonomy.php
diff --git tests/phpunit/tests/term/wpTaxonomy.php tests/phpunit/tests/term/wpTaxonomy.php new file mode 100644 index 0000000..d80700a
- + 1 <?php 2 3 /** 4 * @group taxonomy 5 */ 6 class Tests_WP_Taxonomy extends WP_UnitTestCase { 7 public function test_get_instance_invalid_taxonomy() { 8 $this->assertFalse( WP_Taxonomy::get_instance( 'foo' ) ); 9 } 10 11 public function test_get_instance_builtin_taxonomy() { 12 $taxonomy = WP_Taxonomy::get_instance( 'category' ); 13 $this->assertInstanceOf( 'WP_Taxonomy', $taxonomy ); 14 $this->assertEquals( 'category', $taxonomy->name ); 15 16 $taxonomy = WP_Taxonomy::get_instance( 'post_tag' ); 17 $this->assertInstanceOf( 'WP_Taxonomy', $taxonomy ); 18 $this->assertEquals( 'post_tag', $taxonomy->name ); 19 } 20 21 public function test_array_access() { 22 $taxonomy = rand_str(); 23 $taxonomy_object = register_taxonomy( $taxonomy, 'post' ); 24 $this->assertEquals( $taxonomy, $taxonomy_object['name'] ); 25 $this->assertEquals( $taxonomy, $taxonomy_object->name ); 26 } 27 }