Changeset 36104 for branches/4.4
- Timestamp:
- 12/27/2015 02:13:20 AM (9 years ago)
- Location:
- branches/4.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.4
-
branches/4.4/src/wp-admin/includes/class-wp-screen.php
r35461 r36104 531 531 } 532 532 533 sort( $priorities );533 ksort( $priorities ); 534 534 535 535 $sorted = array(); -
branches/4.4/tests/phpunit/tests/admin/includesScreen.php
r34370 r36104 3 3 /** 4 4 * @group admin 5 * @group adminScreen 5 6 */ 6 7 class Tests_Admin_includesScreen extends WP_UnitTestCase { … … 188 189 $tab_1 = rand_str(); 189 190 $tab_1_args = array( 191 'title' => 'Help!', 190 192 'id' => $tab_1, 191 'title' => 'Help!',192 193 'content' => 'Some content', 193 194 'callback' => false, 194 'priority' => 1 1,195 'priority' => 10, 195 196 ); 196 197 197 198 $tab_2 = rand_str(); 198 199 $tab_2_args = array( 200 'title' => 'Help!', 199 201 'id' => $tab_2, 200 'title' => 'Help!',201 202 'content' => 'Some content', 202 203 'callback' => false, 203 'priority' => 9, 204 'priority' => 2, 205 ); 206 $tab_3 = rand_str(); 207 $tab_3_args = array( 208 'title' => 'help!', 209 'id' => $tab_3, 210 'content' => 'some content', 211 'callback' => false, 212 'priority' => 40, 213 ); 214 $tab_4 = rand_str(); 215 $tab_4_args = array( 216 'title' => 'help!', 217 'id' => $tab_4, 218 'content' => 'some content', 219 'callback' => false, 220 // Don't include a priority 204 221 ); 205 222 206 223 $screen = get_current_screen(); 207 224 208 // Add help tabs.225 // add help tabs. 209 226 210 227 $screen->add_help_tab( $tab_1_args ); 211 $this->assert Equals( $screen->get_help_tab( $tab_1 ), $tab_1_args );228 $this->assertequals( $screen->get_help_tab( $tab_1 ), $tab_1_args ); 212 229 213 230 $screen->add_help_tab( $tab_2_args ); 214 231 $this->assertEquals( $screen->get_help_tab( $tab_2 ), $tab_2_args ); 215 232 233 $screen->add_help_tab( $tab_3_args ); 234 $this->assertEquals( $screen->get_help_tab( $tab_3 ), $tab_3_args ); 235 236 $screen->add_help_tab( $tab_4_args ); 237 // Priority is added with the default for future calls 238 $tab_4_args[ 'priority' ] = 10; 239 $this->assertEquals( $screen->get_help_tab( $tab_4 ), $tab_4_args ); 240 216 241 $tabs = $screen->get_help_tabs(); 217 $this->assertEquals( 2, count( $tabs ) );242 $this->assertEquals( 4, count( $tabs ) ); 218 243 $this->assertArrayHasKey( $tab_1, $tabs ); 219 244 $this->assertArrayHasKey( $tab_2, $tabs ); 245 $this->assertArrayHasKey( $tab_3, $tabs ); 246 $this->assertArrayHasKey( $tab_4, $tabs ); 220 247 221 248 // Test priority order. 222 249 223 $this->assert Equals( $tabs,array(250 $this->assertSame( array( 224 251 $tab_2 => $tab_2_args, 225 252 $tab_1 => $tab_1_args, 226 ) ); 253 $tab_4 => $tab_4_args, 254 $tab_3 => $tab_3_args, 255 ), $tabs ); 227 256 228 257 $screen->remove_help_tab( $tab_1 ); 229 258 $this->assertNull( $screen->get_help_tab( $tab_1 ) ); 230 $this->assert Equals( 1, count( $screen->get_help_tabs() ) );259 $this->assertSame( 3, count( $screen->get_help_tabs() ) ); 231 260 232 261 $screen->remove_help_tab( $tab_2 ); 233 262 $this->assertNull( $screen->get_help_tab( $tab_2 ) ); 234 $this->assertEquals( 0, count( $screen->get_help_tabs() ) ); 263 $this->assertSame( 2, count( $screen->get_help_tabs() ) ); 264 265 $screen->remove_help_tab( $tab_3 ); 266 $this->assertNull( $screen->get_help_tab( $tab_3 ) ); 267 $this->assertSame( 1, count( $screen->get_help_tabs() ) ); 268 269 $screen->remove_help_tab( $tab_4 ); 270 $this->assertNull( $screen->get_help_tab( $tab_4 ) ); 271 $this->assertSame( 0, count( $screen->get_help_tabs() ) ); 235 272 236 273 $screen->remove_help_tabs(); 237 $this->assertEquals( $screen->get_help_tabs(), array() );274 $this->assertEquals( array(), $screen->get_help_tabs() ); 238 275 } 239 276
Note: See TracChangeset
for help on using the changeset viewer.