Changeset 47338 for branches/3.8/tests/phpunit/tests/taxonomy.php
- Timestamp:
- 02/21/2020 01:05:39 PM (5 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
- Property svn:mergeinfo changed
-
branches/3.8/tests/phpunit/tests/taxonomy.php
r25923 r47338 106 106 107 107 /** 108 * @ticket 11058109 */110 function test_registering_taxonomies_to_object_types() {111 // Create a taxonomy to test with112 $tax = 'test_tax';113 $this->assertFalse( taxonomy_exists($tax) );114 register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );115 116 // Create a post type to test with117 $post_type = 'test_cpt';118 $this->assertFalse( get_post_type( $post_type ) );119 $this->assertObjectHasAttribute( 'name', register_post_type( $post_type ) );120 121 // Core taxonomy, core post type122 $this->assertTrue( unregister_taxonomy_for_object_type( 'category', 'post' ) );123 $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'post' ) );124 $this->assertTrue( register_taxonomy_for_object_type( 'category', 'post' ) );125 126 // Core taxonomy, non-core post type127 $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );128 $this->assertTrue( unregister_taxonomy_for_object_type( 'category', $post_type ) );129 $this->assertFalse( unregister_taxonomy_for_object_type( 'category', $post_type ) );130 $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );131 132 // Core taxonomies, non-post object types133 $this->assertFalse( register_taxonomy_for_object_type( 'category', 'user' ) );134 $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'user' ) );135 136 // Non-core taxonomy, core post type137 $this->assertTrue( unregister_taxonomy_for_object_type( $tax, 'post' ) );138 $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'post' ) );139 $this->assertTrue( register_taxonomy_for_object_type( $tax, 'post' ) );140 141 // Non-core taxonomy, non-core post type142 $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );143 $this->assertTrue( unregister_taxonomy_for_object_type( $tax, $post_type ) );144 $this->assertFalse( unregister_taxonomy_for_object_type( $tax, $post_type ) );145 $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );146 147 // Non-core taxonomies, non-post object types148 $this->assertFalse( register_taxonomy_for_object_type( $tax, 'user' ) );149 $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'user' ) );150 151 unset($GLOBALS['wp_taxonomies'][$tax]);152 _unregister_post_type( $post_type );153 154 }155 /**156 108 * @ticket 25706 157 109 */
Note: See TracChangeset
for help on using the changeset viewer.