Changeset 48937 for trunk/tests/phpunit/tests/admin/includesScreen.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesScreen.php
r47122 r48937 204 204 set_current_screen(); 205 205 206 $this->assert Equals( $screen->id, $current_screen->id, $hook_name );207 $this->assert Equals( $screen->base, $current_screen->base, $hook_name );206 $this->assertSame( $screen->id, $current_screen->id, $hook_name ); 207 $this->assertSame( $screen->base, $current_screen->base, $hook_name ); 208 208 if ( isset( $screen->action ) ) { 209 $this->assert Equals( $screen->action, $current_screen->action, $hook_name );209 $this->assertSame( $screen->action, $current_screen->action, $hook_name ); 210 210 } 211 211 if ( isset( $screen->post_type ) ) { 212 $this->assert Equals( $screen->post_type, $current_screen->post_type, $hook_name );212 $this->assertSame( $screen->post_type, $current_screen->post_type, $hook_name ); 213 213 } else { 214 214 $this->assertEmpty( $current_screen->post_type, $hook_name ); 215 215 } 216 216 if ( isset( $screen->taxonomy ) ) { 217 $this->assert Equals( $screen->taxonomy, $current_screen->taxonomy, $hook_name );217 $this->assertSame( $screen->taxonomy, $current_screen->taxonomy, $hook_name ); 218 218 } 219 219 … … 238 238 function test_post_type_as_hookname() { 239 239 $screen = convert_to_screen( 'page' ); 240 $this->assert Equals( $screen->post_type, 'page' );241 $this->assert Equals( $screen->base, 'post' );242 $this->assert Equals( $screen->id, 'page' );240 $this->assertSame( $screen->post_type, 'page' ); 241 $this->assertSame( $screen->base, 'post' ); 242 $this->assertSame( $screen->id, 'page' ); 243 243 $this->assertTrue( $screen->is_block_editor ); 244 244 } … … 247 247 register_post_type( 'value-add' ); 248 248 $screen = convert_to_screen( 'value-add' ); // The '-add' part is key. 249 $this->assert Equals( $screen->post_type, 'value-add' );250 $this->assert Equals( $screen->base, 'post' );251 $this->assert Equals( $screen->id, 'value-add' );249 $this->assertSame( $screen->post_type, 'value-add' ); 250 $this->assertSame( $screen->base, 'post' ); 251 $this->assertSame( $screen->id, 'value-add' ); 252 252 $this->assertFalse( $screen->is_block_editor ); // Post types do not support `show_in_rest` by default. 253 253 254 254 $screen = convert_to_screen( 'edit-value-add' ); // The '-add' part is key. 255 $this->assert Equals( $screen->post_type, 'value-add' );256 $this->assert Equals( $screen->base, 'edit' );257 $this->assert Equals( $screen->id, 'edit-value-add' );255 $this->assertSame( $screen->post_type, 'value-add' ); 256 $this->assertSame( $screen->base, 'edit' ); 257 $this->assertSame( $screen->id, 'edit-value-add' ); 258 258 $this->assertFalse( $screen->is_block_editor ); // Post types do not support `show_in_rest` by default. 259 259 } … … 262 262 register_taxonomy( 'old-or-new', 'post' ); 263 263 $screen = convert_to_screen( 'edit-old-or-new' ); // The '-new' part is key. 264 $this->assert Equals( $screen->taxonomy, 'old-or-new' );265 $this->assert Equals( $screen->base, 'edit-tags' );266 $this->assert Equals( $screen->id, 'edit-old-or-new' );264 $this->assertSame( $screen->taxonomy, 'old-or-new' ); 265 $this->assertSame( $screen->base, 'edit-tags' ); 266 $this->assertSame( $screen->id, 'edit-old-or-new' ); 267 267 $this->assertFalse( $screen->is_block_editor ); 268 268 } … … 271 271 register_post_type( 'edit-some-thing' ); 272 272 $screen = convert_to_screen( 'edit-some-thing' ); 273 $this->assert Equals( $screen->post_type, 'edit-some-thing' );274 $this->assert Equals( $screen->base, 'post' );275 $this->assert Equals( $screen->id, 'edit-some-thing' );273 $this->assertSame( $screen->post_type, 'edit-some-thing' ); 274 $this->assertSame( $screen->base, 'post' ); 275 $this->assertSame( $screen->id, 'edit-some-thing' ); 276 276 $this->assertFalse( $screen->is_block_editor ); // Post types do not support `show_in_rest` by default. 277 277 278 278 $screen = convert_to_screen( 'edit-edit-some-thing' ); 279 $this->assert Equals( $screen->post_type, 'edit-some-thing' );280 $this->assert Equals( $screen->base, 'edit' );281 $this->assert Equals( $screen->id, 'edit-edit-some-thing' );279 $this->assertSame( $screen->post_type, 'edit-some-thing' ); 280 $this->assertSame( $screen->base, 'edit' ); 281 $this->assertSame( $screen->id, 'edit-edit-some-thing' ); 282 282 $this->assertFalse( $screen->is_block_editor ); // Post types do not support `show_in_rest` by default. 283 283 } … … 289 289 // Sorry, core wins here. 290 290 $screen = convert_to_screen( 'edit-comments' ); 291 $this->assert Equals( $screen->base, 'edit-comments' );291 $this->assertSame( $screen->base, 'edit-comments' ); 292 292 293 293 // The post type wins here. convert_to_screen( $post_type ) is only relevant for meta boxes anyway. 294 294 $screen = convert_to_screen( 'comments' ); 295 $this->assert Equals( $screen->base, 'post' );295 $this->assertSame( $screen->base, 'post' ); 296 296 297 297 // Core wins. 298 298 $screen = convert_to_screen( 'edit-tags' ); 299 $this->assert Equals( $screen->base, 'edit-tags' );299 $this->assertSame( $screen->base, 'edit-tags' ); 300 300 301 301 $screen = convert_to_screen( 'tags' ); 302 $this->assert Equals( $screen->base, 'post' );302 $this->assertSame( $screen->base, 'post' ); 303 303 } 304 304 … … 306 306 $tab = __FUNCTION__; 307 307 $tab_args = array( 308 'title' => 'Help!', 308 309 'id' => $tab, 309 'title' => 'Help!',310 310 'content' => 'Some content', 311 311 'callback' => false, … … 314 314 $screen = get_current_screen(); 315 315 $screen->add_help_tab( $tab_args ); 316 $this->assert Equals(316 $this->assertSame( 317 317 $screen->get_help_tab( $tab ), 318 318 array( 319 'title' => 'Help!', 319 320 'id' => $tab, 320 'title' => 'Help!',321 321 'content' => 'Some content', 322 322 'callback' => false, … … 332 332 333 333 $screen->remove_help_tabs(); 334 $this->assert Equals( $screen->get_help_tabs(), array() );334 $this->assertSame( $screen->get_help_tabs(), array() ); 335 335 } 336 336 … … 381 381 382 382 $screen->add_help_tab( $tab_2_args ); 383 $this->assert Equals( $screen->get_help_tab( $tab_2 ), $tab_2_args );383 $this->assertSame( $screen->get_help_tab( $tab_2 ), $tab_2_args ); 384 384 385 385 $screen->add_help_tab( $tab_3_args ); 386 $this->assert Equals( $screen->get_help_tab( $tab_3 ), $tab_3_args );386 $this->assertSame( $screen->get_help_tab( $tab_3 ), $tab_3_args ); 387 387 388 388 $screen->add_help_tab( $tab_4_args ); 389 389 // Priority is added with the default for future calls. 390 390 $tab_4_args['priority'] = 10; 391 $this->assert Equals( $screen->get_help_tab( $tab_4 ), $tab_4_args );391 $this->assertSame( $screen->get_help_tab( $tab_4 ), $tab_4_args ); 392 392 393 393 $tabs = $screen->get_help_tabs(); 394 $this->assert Equals( 4, count( $tabs ) );394 $this->assertSame( 4, count( $tabs ) ); 395 395 $this->assertArrayHasKey( $tab_1, $tabs ); 396 396 $this->assertArrayHasKey( $tab_2, $tabs ); … … 427 427 428 428 $screen->remove_help_tabs(); 429 $this->assert Equals( array(), $screen->get_help_tabs() );429 $this->assertSame( array(), $screen->get_help_tabs() ); 430 430 } 431 431 … … 444 444 445 445 $screen->add_option( $option, $option_args ); 446 $this->assert Equals( $screen->get_option( $option ), $option_args );446 $this->assertSame( $screen->get_option( $option ), $option_args ); 447 447 448 448 $options = $screen->get_options(); … … 453 453 454 454 $screen->remove_options(); 455 $this->assert Equals( $screen->get_options(), array() );455 $this->assertSame( $screen->get_options(), array() ); 456 456 } 457 457
Note: See TracChangeset
for help on using the changeset viewer.