Make WordPress Core

Changeset 40558


Ignore:
Timestamp:
04/29/2017 09:15:34 PM (8 years ago)
Author:
johnbillion
Message:

Posts, Post Types: Correct the attachment post type template unit test introduced in [38951].

Also adds additional assertions for the templates.

See #18375

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/template.php

    r38951 r40558  
    195195
    196196    public function test_page_template_hierarchy() {
     197        $this->assertEquals( 'templates/page.php', get_page_template_slug( self::$page ) );
    197198        $this->assertTemplateHierarchy( get_permalink( self::$page ), array(
    198199            'templates/page.php',
     
    209210     */
    210211    public function test_single_template_hierarchy_for_post() {
     212        $this->assertEquals( 'templates/post.php', get_page_template_slug( self::$post ) );
    211213        $this->assertTemplateHierarchy( get_permalink( self::$post ), array(
    212214            'templates/post.php',
     
    244246        add_post_meta( $cpt->ID, '_wp_page_template', 'templates/cpt.php' );
    245247
     248        $this->assertEquals( 'templates/cpt.php', get_page_template_slug( $cpt ) );
    246249        $this->assertTemplateHierarchy( get_permalink( $cpt ), array(
    247250            'templates/cpt.php',
     
    283286        ) );
    284287
    285         add_post_meta( $attachment, '_wp_page_template', 'templates/cpt.php' );
    286 
     288        add_post_meta( $attachment->ID, '_wp_page_template', 'templates/attachment.php' );
     289
     290        $this->assertEquals( 'templates/attachment.php', get_page_template_slug( $attachment ) );
    287291        $this->assertTemplateHierarchy( get_permalink( $attachment ), array(
     292            'templates/attachment.php',
    288293            'image-jpeg.php',
    289294            'jpeg.php',
Note: See TracChangeset for help on using the changeset viewer.