Ticket #39211: 39211.2.patch
File 39211.2.patch, 2.5 KB (added by , 8 years ago) |
---|
-
src/wp-includes/post-template.php
1631 1631 * @return bool True on success, false on failure. 1632 1632 */ 1633 1633 function is_page_template( $template = '' ) { 1634 if ( ! is_singular() ) { 1635 return false; 1636 } 1637 1634 1638 $page_template = get_page_template_slug( get_queried_object_id() ); 1635 1639 1636 1640 if ( empty( $template ) ) -
tests/phpunit/tests/query/conditionals.php
22 22 update_option( 'comments_per_page', 5 ); 23 23 update_option( 'posts_per_page', 5 ); 24 24 25 create_initial_taxonomies(); 25 26 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 26 27 create_initial_taxonomies();28 27 } 29 28 30 29 function test_home() { … … 1074 1073 } 1075 1074 1076 1075 /** 1076 * @ticket 39211 1077 */ 1078 function test_is_page_template_not_singular() { 1079 global $wpdb; 1080 1081 // We need an non-post that shares an ID with a post assigned a template. 1082 $term_id = self::factory()->term->create(); 1083 if ( ! get_post( $term_id ) ) { 1084 $post_id = self::factory()->post->create( array( 'post_type' => 'post' ) ); 1085 $wpdb->update( $wpdb->posts, array( 'ID' => $term_id ), array( 'ID' => $post_id ), array( '%d' ) ); 1086 } 1087 1088 update_post_meta( $term_id, '_wp_page_template', 'example.php' ); 1089 1090 // Verify that the non-post with our ID does not report having a template. 1091 $this->go_to( get_post_permalink( $term_id ) ); 1092 $this->assertTrue( is_page_template( 'example.php' ) ); 1093 $this->go_to( get_term_link( $term_id ) ); 1094 $this->assertInstanceOf( 'WP_Term', get_queried_object() ); // and not something else that would return false, like a 404. 1095 $this->assertFalse( is_page_template( 'example.php' ) ); 1096 } 1097 1098 /** 1077 1099 * @ticket 35902 1078 1100 */ 1079 1101 public function test_is_attachment_should_not_match_numeric_id_to_post_title_beginning_with_id() { -
tests/phpunit/tests/query/verboseRewriteRules.php
10 10 function setUp() { 11 11 parent::setUp(); 12 12 13 create_initial_taxonomies(); 13 14 $this->set_permalink_structure( '/%category%/%year%/%postname%/' ); 14 create_initial_taxonomies();15 15 } 16 16 }