|
@@ 1043-1058 (lines=16) @@
|
| 1040 |
|
$this->assertEqualSets($expected, $found); |
| 1041 |
|
} |
| 1042 |
|
|
| 1043 |
|
public function test_get_terms_hierarchical_tax_hide_empty_false_fields_count() |
| 1044 |
|
{ |
| 1045 |
|
// Set up a clean taxonomy. |
| 1046 |
|
$tax = 'hierarchical_fields'; |
| 1047 |
|
register_taxonomy($tax, 'post', array( 'hierarchical' => true )); |
| 1048 |
|
|
| 1049 |
|
$terms = $this->create_hierarchical_terms_and_posts(); |
| 1050 |
|
|
| 1051 |
|
$found = get_terms( |
| 1052 |
|
$tax, array( |
| 1053 |
|
'hide_empty' => false, |
| 1054 |
|
'fields' => 'count', |
| 1055 |
|
) |
| 1056 |
|
); |
| 1057 |
|
|
| 1058 |
|
_unregister_taxonomy('hierarchical_fields'); |
| 1059 |
|
|
| 1060 |
|
$this->assertEquals(5, $found); |
| 1061 |
|
} |
|
@@ 1063-1079 (lines=17) @@
|
| 1060 |
|
$this->assertEquals(5, $found); |
| 1061 |
|
} |
| 1062 |
|
|
| 1063 |
|
public function test_get_terms_hierarchical_tax_hide_empty_true_fields_count() |
| 1064 |
|
{ |
| 1065 |
|
// Set up a clean taxonomy. |
| 1066 |
|
$tax = 'hierarchical_fields'; |
| 1067 |
|
register_taxonomy($tax, 'post', array( 'hierarchical' => true )); |
| 1068 |
|
|
| 1069 |
|
$terms = $this->create_hierarchical_terms_and_posts(); |
| 1070 |
|
|
| 1071 |
|
$found = get_terms( |
| 1072 |
|
$tax, array( |
| 1073 |
|
'hide_empty' => true, |
| 1074 |
|
'fields' => 'count', |
| 1075 |
|
) |
| 1076 |
|
); |
| 1077 |
|
|
| 1078 |
|
_unregister_taxonomy('hierarchical_fields'); |
| 1079 |
|
|
| 1080 |
|
// When using 'fields=count', 'hierarchical' is forced to false. |
| 1081 |
|
$this->assertEquals(2, $found); |
| 1082 |
|
} |
|
@@ 1084-1100 (lines=17) @@
|
| 1081 |
|
$this->assertEquals(2, $found); |
| 1082 |
|
} |
| 1083 |
|
|
| 1084 |
|
public function test_get_terms_hierarchical_tax_hide_empty_true_fields_count_hierarchical_false() |
| 1085 |
|
{ |
| 1086 |
|
// Set up a clean taxonomy. |
| 1087 |
|
$tax = 'hierarchical_fields'; |
| 1088 |
|
register_taxonomy($tax, 'post', array( 'hierarchical' => true )); |
| 1089 |
|
|
| 1090 |
|
$terms = $this->create_hierarchical_terms_and_posts(); |
| 1091 |
|
|
| 1092 |
|
$found = get_terms( |
| 1093 |
|
$tax, array( |
| 1094 |
|
'hide_empty' => true, |
| 1095 |
|
'fields' => 'count', |
| 1096 |
|
'hierarchical' => false, |
| 1097 |
|
) |
| 1098 |
|
); |
| 1099 |
|
|
| 1100 |
|
_unregister_taxonomy('hierarchical_fields'); |
| 1101 |
|
|
| 1102 |
|
$this->assertEquals(2, $found); |
| 1103 |
|
} |