- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/category/getCategoryParents.php
r39549 r42343 12 12 13 13 $this->c1 = self::factory()->category->create_and_get(); 14 $this->c2 = self::factory()->category->create_and_get( array( 15 'parent' => $this->c1->term_id, 16 ) ); 14 $this->c2 = self::factory()->category->create_and_get( 15 array( 16 'parent' => $this->c1->term_id, 17 ) 18 ); 17 19 } 18 20 … … 22 24 23 25 public function test_with_default_parameters() { 24 $expected = $this->c1->name . '/' . $this->c2->name . '/';25 $found = get_category_parents( $this->c2->term_id );26 $expected = $this->c1->name . '/' . $this->c2->name . '/'; 27 $found = get_category_parents( $this->c2->term_id ); 26 28 $this->assertSame( $expected, $found ); 27 29 } 28 30 29 31 public function test_link_true() { 30 $expected = '<a href="' . get_category_link( $this->c1->term_id ) . '">' . $this->c1->name . '</a>/<a href="' . get_category_link( $this->c2->term_id ) . '">' . $this->c2->name . '</a>/';31 $found = get_category_parents( $this->c2->term_id, true );32 $expected = '<a href="' . get_category_link( $this->c1->term_id ) . '">' . $this->c1->name . '</a>/<a href="' . get_category_link( $this->c2->term_id ) . '">' . $this->c2->name . '</a>/'; 33 $found = get_category_parents( $this->c2->term_id, true ); 32 34 $this->assertSame( $expected, $found ); 33 35 } … … 35 37 public function test_separator() { 36 38 $expected = $this->c1->name . ' --- ' . $this->c2->name . ' --- '; 37 $found = get_category_parents( $this->c2->term_id, false, ' --- ', false );39 $found = get_category_parents( $this->c2->term_id, false, ' --- ', false ); 38 40 $this->assertSame( $expected, $found ); 39 41 } 40 42 41 43 public function test_nicename_false() { 42 $expected = $this->c1->name . '/' . $this->c2->name . '/';43 $found = get_category_parents( $this->c2->term_id, false, '/', false );44 $expected = $this->c1->name . '/' . $this->c2->name . '/'; 45 $found = get_category_parents( $this->c2->term_id, false, '/', false ); 44 46 $this->assertSame( $expected, $found ); 45 47 } 46 48 47 49 public function test_nicename_true() { 48 $expected = $this->c1->slug . '/' . $this->c2->slug . '/';49 $found = get_category_parents( $this->c2->term_id, false, '/', true );50 $expected = $this->c1->slug . '/' . $this->c2->slug . '/'; 51 $found = get_category_parents( $this->c2->term_id, false, '/', true ); 50 52 $this->assertSame( $expected, $found ); 51 53 } … … 58 60 public function test_category_without_parents() { 59 61 $expected = $this->c1->name . '/'; 60 $found = get_category_parents( $this->c1->term_id );62 $found = get_category_parents( $this->c1->term_id ); 61 63 $this->assertSame( $expected, $found ); 62 64 }
Note: See TracChangeset
for help on using the changeset viewer.