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