Changeset 48937 for trunk/tests/phpunit/tests/taxonomy.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/taxonomy.php
r48665 r48937 6 6 class Tests_Taxonomy extends WP_UnitTestCase { 7 7 function test_get_post_taxonomies() { 8 $this->assert Equals( array( 'category', 'post_tag', 'post_format' ), get_object_taxonomies( 'post' ) );8 $this->assertSame( array( 'category', 'post_tag', 'post_format' ), get_object_taxonomies( 'post' ) ); 9 9 } 10 10 11 11 function test_get_link_taxonomies() { 12 $this->assert Equals( array( 'link_category' ), get_object_taxonomies( 'link' ) );12 $this->assertSame( array( 'link_category' ), get_object_taxonomies( 'link' ) ); 13 13 } 14 14 … … 18 18 function test_get_unknown_taxonomies() { 19 19 // Taxonomies for an unknown object type. 20 $this->assert Equals( array(), get_object_taxonomies( rand_str() ) );21 $this->assert Equals( array(), get_object_taxonomies( '' ) );22 $this->assert Equals( array(), get_object_taxonomies( 0 ) );23 $this->assert Equals( array(), get_object_taxonomies( null ) );20 $this->assertSame( array(), get_object_taxonomies( rand_str() ) ); 21 $this->assertSame( array(), get_object_taxonomies( '' ) ); 22 $this->assertSame( array(), get_object_taxonomies( 0 ) ); 23 $this->assertSame( array(), get_object_taxonomies( null ) ); 24 24 } 25 25 … … 30 30 $this->assertTrue( is_object( $tax ) ); 31 31 $this->assertTrue( is_array( $tax->object_type ) ); 32 $this->assert Equals( array( 'post' ), $tax->object_type );32 $this->assertSame( array( 'post' ), $tax->object_type ); 33 33 } 34 34 } … … 39 39 $taxes = get_the_taxonomies( $post_id ); 40 40 $this->assertNotEmpty( $taxes ); 41 $this->assert Equals( array( 'category' ), array_keys( $taxes ) );41 $this->assertSame( array( 'category' ), array_keys( $taxes ) ); 42 42 43 43 $id = self::factory()->tag->create(); … … 47 47 $this->assertNotEmpty( $taxes ); 48 48 $this->assertCount( 2, $taxes ); 49 $this->assert Equals( array( 'category', 'post_tag' ), array_keys( $taxes ) );49 $this->assertSame( array( 'category', 'post_tag' ), array_keys( $taxes ) ); 50 50 } 51 51 … … 57 57 58 58 $taxes = get_the_taxonomies( $post_id, array( 'term_template' => '%2$s' ) ); 59 $this->assert Equals( 'Categories: Uncategorized.', $taxes['category'] );59 $this->assertSame( 'Categories: Uncategorized.', $taxes['category'] ); 60 60 61 61 $taxes = get_the_taxonomies( $post_id, array( 'term_template' => '<span class="foo"><a href="%1$s">%2$s</a></span>' ) ); 62 62 $link = get_category_link( 1 ); 63 $this->assert Equals( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $taxes['category'] );63 $this->assertSame( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $taxes['category'] ); 64 64 } 65 65 … … 91 91 ) 92 92 ); 93 $this->assert Equals( 'Categories: Uncategorized.', $output );93 $this->assertSame( 'Categories: Uncategorized.', $output ); 94 94 95 95 $output = get_echo( … … 103 103 ); 104 104 $link = get_category_link( 1 ); 105 $this->assert Equals( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $output );105 $this->assertSame( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $output ); 106 106 } 107 107 … … 112 112 $this->assertTrue( is_object( $tax ) ); 113 113 $this->assertTrue( is_array( $tax->object_type ) ); 114 $this->assert Equals( array( 'link' ), $tax->object_type );114 $this->assertSame( array( 'link' ), $tax->object_type ); 115 115 } 116 116 } … … 286 286 $terms = get_objects_in_term( 1, 'invalid_taxonomy' ); 287 287 $this->assertInstanceOf( 'WP_Error', $terms ); 288 $this->assert Equals( 'invalid_taxonomy', $terms->get_error_code() );288 $this->assertSame( 'invalid_taxonomy', $terms->get_error_code() ); 289 289 } 290 290 291 291 public function test_get_objects_in_term_should_return_empty_array() { 292 $this->assert Equals( array(), get_objects_in_term( 1, 'post_tag' ) );292 $this->assertSame( array(), get_objects_in_term( 1, 'post_tag' ) ); 293 293 } 294 294 … … 430 430 'cat_name' => 'Updated Name', 431 431 ); 432 $this->assert Equals( 1, wp_insert_category( $cat ) );432 $this->assertSame( 1, wp_insert_category( $cat ) ); 433 433 } 434 434 … … 448 448 'cat_name' => 'Error', 449 449 ); 450 $this->assert Equals( 0, wp_insert_category( $cat, false ) );450 $this->assertSame( 0, wp_insert_category( $cat, false ) ); 451 451 } 452 452 … … 964 964 $problematic_term = current( wp_list_pluck( $terms_obj, 'name' ) ); 965 965 966 $this->assert Equals( $problematic_term, $term_name );966 $this->assertSame( $problematic_term, $term_name ); 967 967 } 968 968
Note: See TracChangeset
for help on using the changeset viewer.