Make WordPress Core

Ticket #34988: 34988.5.diff

File 34988.5.diff, 4.1 KB (added by swissspidy, 9 years ago)

Fixing the unit tests

  • src/wp-admin/admin.php

    diff --git src/wp-admin/admin.php src/wp-admin/admin.php
    index 46977f9..03426c1 100644
    if ( isset($plugin_page) ) { 
    355355                        do_action( 'load-categories.php' );
    356356                elseif ( $taxnow == 'link_category' )
    357357                        do_action( 'load-edit-link-categories.php' );
     358        } elseif( 'term.php' === $pagenow ) {
     359                do_action( 'edit-tags.php' );
    358360        }
    359361}
    360362
  • 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 5a02928..ebd20b8 100644
    final class WP_Screen { 
    304304                                        }
    305305                                        break;
    306306                                case 'edit-tags' :
     307                                case 'term' :
    307308                                        if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) )
    308309                                                $post_type = 'post';
    309310                                        break;
    final class WP_Screen { 
    322323                                $id .= '-' . $post_type;
    323324                                break;
    324325                        case 'edit-tags' :
     326                        case 'term' :
    325327                                if ( null === $taxonomy )
    326328                                        $taxonomy = 'post_tag';
    327329                                // The edit-tags ID does not contain the post type. Look for it in the request.
  • src/wp-admin/term.php

    diff --git src/wp-admin/term.php src/wp-admin/term.php
    index 6d00f50..5454874 100644
     
    1010/** WordPress Administration Bootstrap */
    1111require_once( dirname( __FILE__ ) . '/admin.php' );
    1212
    13 if ( empty( $_REQUEST['term_id'] ) ) {
     13if ( empty( $_REQUEST['tag_ID'] ) ) {
    1414        $sendback = admin_url( 'edit-tags.php' );
    1515        if ( ! empty( $taxnow ) ) {
    1616                $sendback = add_query_arg( array( 'taxonomy' => $taxnow ), $sendback );
    if ( empty( $_REQUEST['term_id'] ) ) { 
    1919        exit;
    2020}
    2121
    22 $term_id = absint( $_REQUEST['term_id'] );
    23 $tag    = get_term( $term_id, $taxnow, OBJECT, 'edit' );
     22$term_id = absint( $_REQUEST['tag_ID'] );
     23$tag     = get_term( $term_id, '', OBJECT, 'edit' );
    2424
    2525if ( ! $tag instanceof WP_Term ) {
    2626        wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
  • src/wp-includes/admin-bar.php

    diff --git src/wp-includes/admin-bar.php src/wp-includes/admin-bar.php
    index 5bb2fcd..ab6d055 100644
    function wp_admin_bar_edit_menu( $wp_admin_bar ) { 
    573573                                        'href' => get_permalink( $post->ID )
    574574                                ) );
    575575                        }
    576                 } elseif ( 'edit-tags' == $current_screen->base
     576                } elseif ( 'term' == $current_screen->base
    577577                        && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag )
    578578                        && ( $tax = get_taxonomy( $tag->taxonomy ) )
    579579                        && $tax->public )
  • src/wp-includes/link-template.php

    diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php
    index 8064814..a7ad29d 100644
    function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) { 
    928928
    929929        $args = array(
    930930                'taxonomy' => $taxonomy,
    931                 'term_id'  => $term->term_id,
     931                'tag_ID'   => $term->term_id,
    932932        );
    933933
    934934        if ( $object_type ) {
  • tests/phpunit/tests/post.php

    diff --git tests/phpunit/tests/post.php tests/phpunit/tests/post.php
    index 4f5a294..a1ec373 100644
    class Tests_Post extends WP_UnitTestCase { 
    991991                $term = reset( $terms );
    992992
    993993                foreach ( $matches[1] as $url ) {
    994                         $this->assertContains( 'term_id=' . $term->term_id, $url );
     994                        $this->assertContains( 'tag_ID=' . $term->term_id, $url );
    995995                        $this->assertContains( 'post_type=new_post_type', $url );
    996996                }
    997997        }
  • tests/phpunit/tests/term/getEditTermLink.php

    diff --git tests/phpunit/tests/term/getEditTermLink.php tests/phpunit/tests/term/getEditTermLink.php
    index 5402327..c0844b9 100644
    class Tests_Term_GetEditTermLink extends WP_UnitTestCase { 
    1717                ) );
    1818
    1919                $actual = get_edit_term_link( $term1, 'wptests_tax' );
    20                 $expected = 'http://' . WP_TESTS_DOMAIN . '/wp-admin/term.php?taxonomy=wptests_tax&term_id=' . $term1 . '&post_type=post';
     20                $expected = 'http://' . WP_TESTS_DOMAIN . '/wp-admin/term.php?taxonomy=wptests_tax&tag_ID=' . $term1 . '&post_type=post';
    2121                $this->assertEquals( $expected, $actual );
    2222        }
    2323