WordPress.org

Make WordPress Core

Ticket #36510: 36510.diff

File 36510.diff, 1.3 KB (added by swissspidy, 3 years ago)
  • src/wp-includes/post-template.php

    diff --git src/wp-includes/post-template.php src/wp-includes/post-template.php
    index a441d74..3da4245 100644
    function get_body_class( $class = '' ) { 
    582582                $classes[] = 'attachment';
    583583        if ( is_404() )
    584584                $classes[] = 'error404';
    585         if ( is_singular() ) {
    586                 $classes[] = 'singular';
    587         }
    588585
    589586        if ( is_single() ) {
    590587                $post_id = $wp_query->get_queried_object_id();
  • tests/phpunit/tests/post/getBodyClass.php

    diff --git tests/phpunit/tests/post/getBodyClass.php tests/phpunit/tests/post/getBodyClass.php
    index 3e3b861..c777652 100644
    class Tests_Post_GetBodyClass extends WP_UnitTestCase { 
    7777                $this->go_to( home_url( "?wptests_tax={$term3->slug}" ) );
    7878                $this->assertContains( "term-$term_id3", get_body_class() );
    7979        }
    80 
    81         /**
    82          * @ticket 35164
    83          */
    84         public function test_singular_body_classes() {
    85                 $post_id = self::factory()->post->create();
    86                 $this->go_to( get_permalink( $post_id ) );
    87 
    88                 $class = get_body_class();
    89                 $this->assertContains( "single-post", $class );
    90                 $this->assertContains( "postid-{$post_id}", $class );
    91                 $this->assertContains( "single-format-standard", $class );
    92                 $this->assertContains( "singular", $class );
    93 
    94         }
    95 
    9680}