| | 1 | <?php |
| | 2 | |
| | 3 | class Tests_List_Page extends WP_UnitTestCase { |
| | 4 | var $pages; |
| | 5 | |
| | 6 | /* |
| | 7 | $defaults = array( |
| | 8 | 'depth' => 0, |
| | 9 | 'show_date' => '', |
| | 10 | 'date_format' => get_option('date_format'), |
| | 11 | 'child_of' => 0, |
| | 12 | 'exclude' => '', |
| | 13 | 'title_li' => __('Pages'), |
| | 14 | 'echo' => 1, |
| | 15 | 'authors' => '', |
| | 16 | 'sort_column' => 'menu_order, post_title', |
| | 17 | 'link_before' => '', |
| | 18 | 'link_after' => '', |
| | 19 | 'walker' => '', |
| | 20 | 'include' => '', |
| | 21 | 'post_type' => 'page', |
| | 22 | 'post_status' => 'publish', |
| | 23 | ); |
| | 24 | */ |
| | 25 | function setUp() { |
| | 26 | parent::setUp(); |
| | 27 | global $wpdb; |
| | 28 | $wpdb->query( 'TRUNCATE ' . $wpdb->prefix . 'posts' ); |
| | 29 | $pages = array(); |
| | 30 | $this->factory->user->create(); |
| | 31 | $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 1' ) ); |
| | 32 | $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 2' ) ); |
| | 33 | $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 3', 'post_author' => '2' ) ); |
| | 34 | |
| | 35 | foreach ( $pages as $page ) { |
| | 36 | $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 1' ) ); |
| | 37 | $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 2' ) ); |
| | 38 | $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 3' ) ); |
| | 39 | } |
| | 40 | } |
| | 41 | |
| | 42 | function test_wp_list_pages_default() { |
| | 43 | $args = array( |
| | 44 | 'echo' => false |
| | 45 | ); |
| | 46 | $expected['default'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> |
| | 47 | <ul class=\'children\'> |
| | 48 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> |
| | 49 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li> |
| | 50 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li> |
| | 51 | </ul> |
| | 52 | </li> |
| | 53 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> |
| | 54 | <ul class=\'children\'> |
| | 55 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li> |
| | 56 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> |
| | 57 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> |
| | 58 | </ul> |
| | 59 | </li> |
| | 60 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> |
| | 61 | <ul class=\'children\'> |
| | 62 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li> |
| | 63 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li> |
| | 64 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li> |
| | 65 | </ul> |
| | 66 | </li> |
| | 67 | </ul></li>'; |
| | 68 | $actual = wp_list_pages( $args ); |
| | 69 | $this->AssertEquals( $expected['default'], $actual ); |
| | 70 | } |
| | 71 | |
| | 72 | function test_wp_list_pages_depth() { |
| | 73 | $args = array( |
| | 74 | 'echo' => false, |
| | 75 | 'depth' => 1 |
| | 76 | ); |
| | 77 | $expected['depth'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li> |
| | 78 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li> |
| | 79 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> |
| | 80 | </ul></li>'; |
| | 81 | $actual = wp_list_pages( $args ); |
| | 82 | $this->AssertEquals( $expected['depth'], $actual ); |
| | 83 | } |
| | 84 | |
| | 85 | function test_wp_list_pages_show_date() { |
| | 86 | $args = array( |
| | 87 | 'echo' => false, |
| | 88 | 'depth' => 1, |
| | 89 | 'show_date' => true |
| | 90 | ); |
| | 91 | $expected['show_date'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> ' . date( 'F j, Y' ) . '</li> |
| | 92 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> ' . date( 'F j, Y' ) . '</li> |
| | 93 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> ' . date( 'F j, Y' ) . '</li> |
| | 94 | </ul></li>'; |
| | 95 | $actual = wp_list_pages( $args ); |
| | 96 | $this->AssertEquals( $expected['show_date'], $actual ); |
| | 97 | } |
| | 98 | |
| | 99 | function test_wp_list_pages_date_format() { |
| | 100 | $args = array( |
| | 101 | 'echo' => false, |
| | 102 | 'show_date' => true, |
| | 103 | 'date_format' => 'l, F j, Y' |
| | 104 | ); |
| | 105 | $expected['date_format'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> ' . date( 'l, F j, Y' ) . ' |
| | 106 | <ul class=\'children\'> |
| | 107 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 108 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 109 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 110 | </ul> |
| | 111 | </li> |
| | 112 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> ' . date( 'l, F j, Y' ) . ' |
| | 113 | <ul class=\'children\'> |
| | 114 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 115 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 116 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 117 | </ul> |
| | 118 | </li> |
| | 119 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> ' . date( 'l, F j, Y' ) . ' |
| | 120 | <ul class=\'children\'> |
| | 121 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 122 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 123 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a> ' . date( 'l, F j, Y' ) . '</li> |
| | 124 | </ul> |
| | 125 | </li> |
| | 126 | </ul></li>'; |
| | 127 | $actual = wp_list_pages( $args ); |
| | 128 | $this->AssertEquals( $expected['date_format'], $actual ); |
| | 129 | } |
| | 130 | |
| | 131 | function test_wp_list_pages_child_of() { |
| | 132 | $args = array( |
| | 133 | 'echo' => false, |
| | 134 | 'child_of' => 2 |
| | 135 | ); |
| | 136 | $expected['child_of'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li> |
| | 137 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> |
| | 138 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> |
| | 139 | </ul></li>'; |
| | 140 | $actual = wp_list_pages( $args ); |
| | 141 | $this->AssertEquals( $expected['child_of'], $actual ); |
| | 142 | } |
| | 143 | |
| | 144 | function test_wp_list_pages_exclude() { |
| | 145 | $args = array( |
| | 146 | 'echo' => false, |
| | 147 | 'exclude' => '2, 2' |
| | 148 | ); |
| | 149 | $expected['exclude'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> |
| | 150 | <ul class=\'children\'> |
| | 151 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> |
| | 152 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li> |
| | 153 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li> |
| | 154 | </ul> |
| | 155 | </li> |
| | 156 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> |
| | 157 | <ul class=\'children\'> |
| | 158 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li> |
| | 159 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li> |
| | 160 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li> |
| | 161 | </ul> |
| | 162 | </li> |
| | 163 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li> |
| | 164 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> |
| | 165 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> |
| | 166 | </ul></li>'; |
| | 167 | $actual = wp_list_pages( $args ); |
| | 168 | $this->AssertEquals( $expected['exclude'], $actual ); |
| | 169 | } |
| | 170 | |
| | 171 | function test_wp_list_pages_title_li() { |
| | 172 | $args = array( |
| | 173 | 'echo' => false, |
| | 174 | 'depth' => 1, |
| | 175 | 'title_li' => 'PageTitle' |
| | 176 | ); |
| | 177 | $expected['title_li'] = '<li class="pagenav">PageTitle<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li> |
| | 178 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li> |
| | 179 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> |
| | 180 | </ul></li>'; |
| | 181 | $actual = wp_list_pages( $args ); |
| | 182 | $this->AssertEquals( $expected['title_li'], $actual ); |
| | 183 | } |
| | 184 | |
| | 185 | function test_wp_list_pages_echo() { |
| | 186 | $args = array( |
| | 187 | 'echo' => true, |
| | 188 | 'depth' => 1 |
| | 189 | ); |
| | 190 | $expected['echo'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li> |
| | 191 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li> |
| | 192 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> |
| | 193 | </ul></li>'; |
| | 194 | ob_start(); |
| | 195 | wp_list_pages( $args ); |
| | 196 | $actual = ob_get_clean(); |
| | 197 | $this->AssertEquals( $expected['echo'], $actual ); |
| | 198 | } |
| | 199 | |
| | 200 | function test_wp_list_pages_authors() { |
| | 201 | $args = array( |
| | 202 | 'echo' => false, |
| | 203 | 'authors' => '2', |
| | 204 | ); |
| | 205 | $expected['authors'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-3"><a href="' . get_permalink( 3) . '">Parent 3</a></li> |
| | 206 | </ul></li>'; |
| | 207 | $actual = wp_list_pages( $args ); |
| | 208 | $this->AssertEquals( $expected['authors'], $actual ); |
| | 209 | } |
| | 210 | |
| | 211 | function test_wp_list_pages_number() { |
| | 212 | $args = array( |
| | 213 | 'echo' => false, |
| | 214 | 'number' => 1, |
| | 215 | ); |
| | 216 | $expected['number'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> |
| | 217 | </ul></li>'; |
| | 218 | $actual = wp_list_pages( $args ); |
| | 219 | $this->AssertEquals( $expected['number'], $actual ); |
| | 220 | } |
| | 221 | |
| | 222 | function test_wp_list_pages_sort_column() { |
| | 223 | $args = array( |
| | 224 | 'echo' => false, |
| | 225 | 'sort_column' => 'post_author', |
| | 226 | 'sort_order' => 'DESC' |
| | 227 | ); |
| | 228 | $expected['sort_column'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> |
| | 229 | <ul class=\'children\'> |
| | 230 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li> |
| | 231 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li> |
| | 232 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li> |
| | 233 | </ul> |
| | 234 | </li> |
| | 235 | <li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> |
| | 236 | <ul class=\'children\'> |
| | 237 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> |
| | 238 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li> |
| | 239 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li> |
| | 240 | </ul> |
| | 241 | </li> |
| | 242 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> |
| | 243 | <ul class=\'children\'> |
| | 244 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li> |
| | 245 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> |
| | 246 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> |
| | 247 | </ul> |
| | 248 | </li> |
| | 249 | </ul></li>'; |
| | 250 | $actual = wp_list_pages( $args ); |
| | 251 | $this->AssertEquals( $expected['sort_column'], $actual ); |
| | 252 | } |
| | 253 | |
| | 254 | function test_wp_list_pages_link_before() { |
| | 255 | $args = array( |
| | 256 | 'echo' => false, |
| | 257 | 'link_before' => 'BEFORE' |
| | 258 | ); |
| | 259 | $expected['link_before'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">BEFOREParent 1</a> |
| | 260 | <ul class=\'children\'> |
| | 261 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">BEFOREChild 1</a></li> |
| | 262 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">BEFOREChild 2</a></li> |
| | 263 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">BEFOREChild 3</a></li> |
| | 264 | </ul> |
| | 265 | </li> |
| | 266 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">BEFOREParent 2</a> |
| | 267 | <ul class=\'children\'> |
| | 268 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">BEFOREChild 1</a></li> |
| | 269 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">BEFOREChild 2</a></li> |
| | 270 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">BEFOREChild 3</a></li> |
| | 271 | </ul> |
| | 272 | </li> |
| | 273 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">BEFOREParent 3</a> |
| | 274 | <ul class=\'children\'> |
| | 275 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">BEFOREChild 1</a></li> |
| | 276 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">BEFOREChild 2</a></li> |
| | 277 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">BEFOREChild 3</a></li> |
| | 278 | </ul> |
| | 279 | </li> |
| | 280 | </ul></li>'; |
| | 281 | $actual = wp_list_pages( $args ); |
| | 282 | $this->AssertEquals( $expected['link_before'], $actual ); |
| | 283 | } |
| | 284 | |
| | 285 | function test_wp_list_pages_link_after() { |
| | 286 | $args = array( |
| | 287 | 'echo' => false, |
| | 288 | 'link_after' => 'AFTER' |
| | 289 | ); |
| | 290 | $expected['link_after'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1AFTER</a> |
| | 291 | <ul class=\'children\'> |
| | 292 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1AFTER</a></li> |
| | 293 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2AFTER</a></li> |
| | 294 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3AFTER</a></li> |
| | 295 | </ul> |
| | 296 | </li> |
| | 297 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2AFTER</a> |
| | 298 | <ul class=\'children\'> |
| | 299 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1AFTER</a></li> |
| | 300 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2AFTER</a></li> |
| | 301 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3AFTER</a></li> |
| | 302 | </ul> |
| | 303 | </li> |
| | 304 | <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3AFTER</a> |
| | 305 | <ul class=\'children\'> |
| | 306 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1AFTER</a></li> |
| | 307 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2AFTER</a></li> |
| | 308 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3AFTER</a></li> |
| | 309 | </ul> |
| | 310 | </li> |
| | 311 | </ul></li>'; |
| | 312 | $actual = wp_list_pages( $args ); |
| | 313 | $this->AssertEquals( $expected['link_after'], $actual ); |
| | 314 | } |
| | 315 | |
| | 316 | |
| | 317 | function test_wp_list_pages_include() { |
| | 318 | $args = array( |
| | 319 | 'echo' => false, |
| | 320 | 'include' => '1,3' |
| | 321 | ); |
| | 322 | $expected['include'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li> |
| | 323 | <li class="page_item page-item-3"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> |
| | 324 | </ul></li>'; |
| | 325 | $actual = wp_list_pages( $args ); |
| | 326 | $this->AssertEquals( $expected['include'], $actual ); |
| | 327 | } |
| | 328 | |
| | 329 | function test_wp_list_pages_exclude_tree() { |
| | 330 | $args = array( |
| | 331 | 'echo' => false, |
| | 332 | 'exclude_tree' => '2, 3' |
| | 333 | ); |
| | 334 | $expected['exclude'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> |
| | 335 | <ul class=\'children\'> |
| | 336 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> |
| | 337 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li> |
| | 338 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li> |
| | 339 | </ul> |
| | 340 | </li> |
| | 341 | </ul></li>'; |
| | 342 | $actual = wp_list_pages( $args ); |
| | 343 | $this->AssertEquals( $expected['exclude'], $actual ); |
| | 344 | } |
| | 345 | |
| | 346 | /** |
| | 347 | * @ticket 27326 |
| | 348 | */ |
| | 349 | function test_wp_list_page_combo_exclude_depth() { |
| | 350 | $args = array( |
| | 351 | 'echo' => false, |
| | 352 | 'exclude' => '3', |
| | 353 | 'depth' => 3 |
| | 354 | ); |
| | 355 | $expected['exclude_depth'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> |
| | 356 | <ul class=\'children\'> |
| | 357 | <li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> |
| | 358 | <li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li> |
| | 359 | <li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li> |
| | 360 | </ul> |
| | 361 | </li> |
| | 362 | <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> |
| | 363 | <ul class=\'children\'> |
| | 364 | <li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li> |
| | 365 | <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> |
| | 366 | <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> |
| | 367 | </ul> |
| | 368 | </li> |
| | 369 | <li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li> |
| | 370 | <li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li> |
| | 371 | <li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li> |
| | 372 | </ul></li>'; |
| | 373 | $actual = wp_list_pages( $args ); |
| | 374 | $this->AssertEquals( $expected['exclude_depth'], $actual ); |
| | 375 | } |
| | 376 | |
| | 377 | } |