Make WordPress Core

Changeset 30148


Ignore:
Timestamp:
11/01/2014 04:00:59 AM (10 years ago)
Author:
boonebgorges
Message:

Clean up 'post-thumbnail' theme support unit tests.

  • Separate into smaller test methods.
  • Remove incorrect tests. A number of assertions in the existing test have always incorrectly described the behavior of current_theme_supports( 'post-thumbnails' ), but no one ever noticed because the tests had been designed to bail when _wp_render_title_tag() did not exist. The failures finally became visible when that function was introduced in [30074].

See #18548.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/support.php

    r29894 r30148  
    3535    }
    3636
    37     function test_post_thumbnails() {
     37    public function test_post_thumbnails() {
    3838        add_theme_support( 'post-thumbnails' );
    3939        $this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
     
    4242        add_theme_support( 'post-thumbnails' );
    4343        $this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
     44    }
    4445
    45         // simple array of post types.
     46    public function test_post_thumbnails_flat_array_of_post_types() {
    4647        add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
    4748        $this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
     
    5051        remove_theme_support( 'post-thumbnails' );
    5152        $this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
     53    }
    5254
    53         #WP18548
    54         if ( ! function_exists( '_wp_render_title_tag' ) )
    55             return;
    56 
    57         // array of arguments, with the key of 'types' holding the post types.
    58         add_theme_support( 'post-thumbnails', array( 'types' => array( 'post', 'page' ) ) );
    59         $this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
    60         $this->assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
    61         $this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
    62         remove_theme_support( 'post-thumbnails' );
    63         $this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
    64 
     55    public function test_post_thumbnails_types_true() {
    6556        // array of arguments, with the key of 'types' holding the post types.
    6657        add_theme_support( 'post-thumbnails', array( 'types' => true ) );
     
    6960        remove_theme_support( 'post-thumbnails' );
    7061        $this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
    71 
    72         // array of arguments, with some other argument, and no 'types' argument.
    73         add_theme_support( 'post-thumbnails', array( rand_str() => rand_str() ) );
    74         $this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
    75         $this->assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
    76         remove_theme_support( 'post-thumbnails' );
    77         $this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
    78 
    7962    }
    8063
Note: See TracChangeset for help on using the changeset viewer.