Make WordPress Core

Ticket #38686: 38686.2.diff

File 38686.2.diff, 1.4 KB (added by xrmx, 8 years ago)

patch with failing tests

  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index 9e20aa0..98e01fe 100644
    function register_post_status( $post_status, $args = array() ) { 
    815815                $args->label = $post_status;
    816816
    817817        if ( false === $args->label_count )
    818                 $args->label_count = array( $args->label, $args->label );
     818                $args->label_count = _n_noop( $args->label, $args->label );
    819819
    820820        $wp_post_statuses[$post_status] = $args;
    821821
  • tests/phpunit/tests/admin/includesListTable.php

    diff --git tests/phpunit/tests/admin/includesListTable.php tests/phpunit/tests/admin/includesListTable.php
    index 39a0b97..1c8352b 100644
    class Tests_Admin_includesListTable extends WP_UnitTestCase { 
    237237
    238238                $this->assertNotContains( 'id="cat"', $output );
    239239        }
     240
     241        /**
     242         * @ticket 38686
     243         */
     244        function test_label_count_fallback_no_notices() {
     245                create_initial_post_types();
     246                register_post_status( 'foo', [
     247                        'label'                     => 'Foo',
     248                        'show_in_admin_status_list' => true,
     249                ] );
     250
     251                $p = self::factory()->post->create_and_get( array(
     252                        'post_type'  => 'post',
     253                        'post_status' => 'foo'
     254                ) );
     255
     256                $this->table->screen->post_status = 'foo';
     257
     258                ob_start();
     259                $this->table->get_views();
     260                $output = ob_get_clean();
     261
     262                $this->assertNotContains( 'Undefined index', $output );
     263        }
    240264}