Changeset 52010 for trunk/tests/phpunit/tests/taxonomy.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/taxonomy.php
r51438 r52010 5 5 */ 6 6 class Tests_Taxonomy extends WP_UnitTestCase { 7 function test_get_post_taxonomies() {7 public function test_get_post_taxonomies() { 8 8 $this->assertSame( array( 'category', 'post_tag', 'post_format' ), get_object_taxonomies( 'post' ) ); 9 9 } 10 10 11 function test_get_link_taxonomies() {11 public function test_get_link_taxonomies() { 12 12 $this->assertSame( array( 'link_category' ), get_object_taxonomies( 'link' ) ); 13 13 } … … 16 16 * @ticket 5417 17 17 */ 18 function test_get_unknown_taxonomies() {18 public function test_get_unknown_taxonomies() { 19 19 // Taxonomies for an unknown object type. 20 20 $this->assertSame( array(), get_object_taxonomies( rand_str() ) ); … … 24 24 } 25 25 26 function test_get_post_taxonomy() {26 public function test_get_post_taxonomy() { 27 27 foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) { 28 28 $tax = get_taxonomy( $taxonomy ); … … 34 34 } 35 35 36 function test_get_the_taxonomies() {36 public function test_get_the_taxonomies() { 37 37 $post_id = self::factory()->post->create(); 38 38 … … 64 64 } 65 65 66 function test_the_taxonomies() {66 public function test_the_taxonomies() { 67 67 $post_id = self::factory()->post->create(); 68 68 … … 79 79 * @ticket 27238 80 80 */ 81 function test_the_taxonomies_term_template() {81 public function test_the_taxonomies_term_template() { 82 82 $post_id = self::factory()->post->create(); 83 83 … … 106 106 } 107 107 108 function test_get_link_taxonomy() {108 public function test_get_link_taxonomy() { 109 109 foreach ( get_object_taxonomies( 'link' ) as $taxonomy ) { 110 110 $tax = get_taxonomy( $taxonomy ); … … 116 116 } 117 117 118 function test_taxonomy_exists_known() {118 public function test_taxonomy_exists_known() { 119 119 $this->assertTrue( taxonomy_exists( 'category' ) ); 120 120 $this->assertTrue( taxonomy_exists( 'post_tag' ) ); … … 122 122 } 123 123 124 function test_taxonomy_exists_unknown() {124 public function test_taxonomy_exists_unknown() { 125 125 $this->assertFalse( taxonomy_exists( rand_str() ) ); 126 126 $this->assertFalse( taxonomy_exists( '' ) ); … … 129 129 } 130 130 131 function test_is_taxonomy_hierarchical() {131 public function test_is_taxonomy_hierarchical() { 132 132 $this->assertTrue( is_taxonomy_hierarchical( 'category' ) ); 133 133 $this->assertFalse( is_taxonomy_hierarchical( 'post_tag' ) ); … … 135 135 } 136 136 137 function test_is_taxonomy_hierarchical_unknown() {137 public function test_is_taxonomy_hierarchical_unknown() { 138 138 $this->assertFalse( is_taxonomy_hierarchical( rand_str() ) ); 139 139 $this->assertFalse( is_taxonomy_hierarchical( '' ) ); … … 142 142 } 143 143 144 function test_register_taxonomy() {144 public function test_register_taxonomy() { 145 145 146 146 // Make up a new taxonomy name, and ensure it's unused. … … 156 156 } 157 157 158 function test_register_hierarchical_taxonomy() {158 public function test_register_hierarchical_taxonomy() { 159 159 160 160 // Make up a new taxonomy name, and ensure it's unused. … … 173 173 * @ticket 48558 174 174 */ 175 function test_register_taxonomy_return_value() {175 public function test_register_taxonomy_return_value() { 176 176 $this->assertInstanceOf( 'WP_Taxonomy', register_taxonomy( 'foo', 'post' ) ); 177 177 } … … 182 182 * @expectedIncorrectUsage register_taxonomy 183 183 */ 184 function test_register_taxonomy_with_too_long_name() {184 public function test_register_taxonomy_with_too_long_name() { 185 185 $this->assertInstanceOf( 'WP_Error', register_taxonomy( 'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) ); 186 186 } … … 191 191 * @expectedIncorrectUsage register_taxonomy 192 192 */ 193 function test_register_taxonomy_with_empty_name() {193 public function test_register_taxonomy_with_empty_name() { 194 194 $this->assertInstanceOf( 'WP_Error', register_taxonomy( '', 'post', array() ) ); 195 195 } … … 225 225 * @ticket 11058 226 226 */ 227 function test_registering_taxonomies_to_object_types() {227 public function test_registering_taxonomies_to_object_types() { 228 228 // Create a taxonomy to test with. 229 229 $tax = 'test_tax'; … … 401 401 * @ticket 25706 402 402 */ 403 function test_in_category() {403 public function test_in_category() { 404 404 $post = self::factory()->post->create_and_get(); 405 405 … … 415 415 } 416 416 417 function test_insert_category_create() {417 public function test_insert_category_create() { 418 418 $cat = array( 419 419 'cat_ID' => 0, … … 424 424 } 425 425 426 function test_insert_category_update() {426 public function test_insert_category_update() { 427 427 $cat = array( 428 428 'cat_ID' => 1, … … 433 433 } 434 434 435 function test_insert_category_force_error_handle() {435 public function test_insert_category_force_error_handle() { 436 436 $cat = array( 437 437 'cat_ID' => 0, … … 442 442 } 443 443 444 function test_insert_category_force_error_no_handle() {444 public function test_insert_category_force_error_no_handle() { 445 445 $cat = array( 446 446 'cat_ID' => 0, … … 972 972 * @ticket 43517 973 973 */ 974 function test_default_term_for_custom_taxonomy() {974 public function test_default_term_for_custom_taxonomy() { 975 975 976 976 wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) ); … … 1037 1037 * @ticket 51320 1038 1038 */ 1039 function test_default_term_for_post_in_multiple_taxonomies() {1039 public function test_default_term_for_post_in_multiple_taxonomies() { 1040 1040 $post_type = 'test_post_type'; 1041 1041 $tax1 = 'test_tax1';
Note: See TracChangeset
for help on using the changeset viewer.