WordPress.org

Make WordPress Core

Ticket #39509: wp_screen_attachment.diff

File wp_screen_attachment.diff, 1.6 KB (added by postpostmodern, 3 years ago)

fix in class WP_Screen and includesScreen unit test

  • src/wp-admin/includes/class-wp-screen.php

    diff --git src/wp-admin/includes/class-wp-screen.php src/wp-admin/includes/class-wp-screen.php
    index a7d9a1a..f4e67c9 100644
    final class WP_Screen { 
    308308                                        if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) )
    309309                                                $post_type = 'post';
    310310                                        break;
     311                                case 'upload':
     312                                        $post_type = 'attachment';
     313                                        break;
    311314                        }
    312315                }
    313316
  • tests/phpunit/tests/admin/includesScreen.php

    diff --git tests/phpunit/tests/admin/includesScreen.php tests/phpunit/tests/admin/includesScreen.php
    index f60e0b8..c721135 100644
    class Tests_Admin_includesScreen extends WP_UnitTestCase { 
    1212                'edit-tags.php' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
    1313                'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
    1414                'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ),
    15                 'upload.php' => array( 'base' => 'upload', 'id' => 'upload' ),
     15                'upload.php' => array( 'base' => 'upload', 'id' => 'upload', 'post_type' => 'attachment' ),
    1616                'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ),
    1717                'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ),
    1818                'link-manager.php' => array( 'base' => 'link-manager', 'id' => 'link-manager' ),