Changeset 59122 for trunk/tests/phpunit/tests/user/capabilities.php
- Timestamp:
- 09/30/2024 06:47:20 AM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/capabilities.php
r58073 r59122 571 571 $expected['edit_app_password'], 572 572 $expected['delete_app_passwords'], 573 $expected['delete_app_password'] 573 $expected['delete_app_password'], 574 $expected['edit_block_binding'] 574 575 ); 575 576 … … 2377 2378 return $data; 2378 2379 } 2380 2381 /** 2382 * Test `edit_block_binding` meta capability is properly mapped. 2383 * 2384 * @ticket 61945 2385 */ 2386 public function test_edit_block_binding_caps_are_mapped_correctly() { 2387 $author = self::$users['administrator']; 2388 $post = self::factory()->post->create_and_get( 2389 array( 2390 'post_author' => $author->ID, 2391 'post_type' => 'post', 2392 ) 2393 ); 2394 2395 foreach ( self::$users as $role => $user ) { 2396 // It should map to `edit_{post_type}` if editing a post. 2397 $this->assertSame( 2398 user_can( $user->ID, 'edit_post', $post->ID ), 2399 user_can( 2400 $user->ID, 2401 'edit_block_binding', 2402 new WP_Block_Editor_Context( 2403 array( 2404 'post' => $post, 2405 'name' => 'core/edit-post', 2406 ) 2407 ) 2408 ), 2409 "Role: {$role} in post editing" 2410 ); 2411 // It should map to `edit_theme_options` if editing a template. 2412 $this->assertSame( 2413 user_can( $user->ID, 'edit_theme_options' ), 2414 user_can( 2415 $user->ID, 2416 'edit_block_binding', 2417 new WP_Block_Editor_Context( 2418 array( 2419 'post' => null, 2420 'name' => 'core/edit-site', 2421 ) 2422 ) 2423 ), 2424 "Role: {$role} in template editing" 2425 ); 2426 } 2427 } 2379 2428 }
Note: See TracChangeset
for help on using the changeset viewer.