diff --git src/wp-admin/includes/class-wp-screen.php src/wp-admin/includes/class-wp-screen.php
index 2537319..7f17c75 100644
|
|
final class WP_Screen { |
530 | 530 | } |
531 | 531 | } |
532 | 532 | |
533 | | sort( $priorities ); |
| 533 | ksort( $priorities ); |
534 | 534 | |
535 | 535 | $sorted = array(); |
536 | 536 | foreach ( $priorities as $list ) { |
… |
… |
final class WP_Screen { |
998 | 998 | * Filter whether to show the Screen Options submit button. |
999 | 999 | * |
1000 | 1000 | * @since 4.4.0 |
1001 | | * |
| 1001 | * |
1002 | 1002 | * @param bool $show_button Whether to show Screen Options submit button. |
1003 | 1003 | * Default false. |
1004 | 1004 | * @param WP_Screen $this Current WP_Screen instance. |
diff --git tests/phpunit/tests/admin/includesScreen.php tests/phpunit/tests/admin/includesScreen.php
index 65603e3..484ab72 100644
|
|
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
187 | 187 | function test_help_tabs_priority() { |
188 | 188 | $tab_1 = rand_str(); |
189 | 189 | $tab_1_args = array( |
190 | | 'id' => $tab_1, |
191 | 190 | 'title' => 'Help!', |
| 191 | 'id' => $tab_1, |
192 | 192 | 'content' => 'Some content', |
193 | 193 | 'callback' => false, |
194 | | 'priority' => 11, |
| 194 | 'priority' => 10, |
195 | 195 | ); |
196 | 196 | |
197 | 197 | $tab_2 = rand_str(); |
198 | 198 | $tab_2_args = array( |
| 199 | 'title' => 'Help!', |
199 | 200 | 'id' => $tab_2, |
| 201 | 'content' => 'Some content', |
| 202 | 'callback' => false, |
| 203 | 'priority' => 2, |
| 204 | ); |
| 205 | $tab_3 = rand_str(); |
| 206 | $tab_3_args = array( |
200 | 207 | 'title' => 'Help!', |
| 208 | 'id' => $tab_3, |
201 | 209 | 'content' => 'Some content', |
202 | 210 | 'callback' => false, |
203 | | 'priority' => 9, |
| 211 | 'priority' => 40, |
204 | 212 | ); |
205 | 213 | |
206 | 214 | $screen = get_current_screen(); |
… |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
213 | 221 | $screen->add_help_tab( $tab_2_args ); |
214 | 222 | $this->assertEquals( $screen->get_help_tab( $tab_2 ), $tab_2_args ); |
215 | 223 | |
| 224 | $screen->add_help_tab( $tab_3_args ); |
| 225 | $this->assertEquals( $screen->get_help_tab( $tab_3 ), $tab_3_args ); |
| 226 | |
216 | 227 | $tabs = $screen->get_help_tabs(); |
217 | | $this->assertEquals( 2, count( $tabs ) ); |
| 228 | $this->assertEquals( 3, count( $tabs ) ); |
218 | 229 | $this->assertArrayHasKey( $tab_1, $tabs ); |
219 | 230 | $this->assertArrayHasKey( $tab_2, $tabs ); |
| 231 | $this->assertArrayHasKey( $tab_3, $tabs ); |
220 | 232 | |
221 | 233 | // Test priority order. |
222 | 234 | |
223 | | $this->assertEquals( $tabs, array( |
| 235 | $this->assertSame( array( |
224 | 236 | $tab_2 => $tab_2_args, |
225 | 237 | $tab_1 => $tab_1_args, |
226 | | ) ); |
| 238 | $tab_3 => $tab_3_args, |
| 239 | ), $tabs ); |
227 | 240 | |
228 | 241 | $screen->remove_help_tab( $tab_1 ); |
229 | 242 | $this->assertNull( $screen->get_help_tab( $tab_1 ) ); |
230 | | $this->assertEquals( 1, count( $screen->get_help_tabs() ) ); |
| 243 | $this->assertSame( 2, count( $screen->get_help_tabs() ) ); |
231 | 244 | |
232 | 245 | $screen->remove_help_tab( $tab_2 ); |
233 | 246 | $this->assertNull( $screen->get_help_tab( $tab_2 ) ); |
234 | | $this->assertEquals( 0, count( $screen->get_help_tabs() ) ); |
| 247 | $this->assertSame( 1, count( $screen->get_help_tabs() ) ); |
| 248 | |
| 249 | $screen->remove_help_tab( $tab_3 ); |
| 250 | $this->assertNull( $screen->get_help_tab( $tab_3 ) ); |
| 251 | $this->assertSame( 0, count( $screen->get_help_tabs() ) ); |
235 | 252 | |
236 | 253 | $screen->remove_help_tabs(); |
237 | | $this->assertEquals( $screen->get_help_tabs(), array() ); |
| 254 | $this->assertEquals( array(), $screen->get_help_tabs() ); |
238 | 255 | } |
239 | 256 | |
240 | 257 | /** |