Ticket #40820: 40820.diff
File 40820.diff, 2.2 KB (added by , 6 years ago) |
---|
-
src/wp-includes/class-wp-theme.php
267 267 } 268 268 } 269 269 270 if ( ! $this->template && $this->stylesheet === $this->headers['Template']) { 271 $this->errors = new WP_Error( 'theme_child_invalid', __( 'The theme defines itself as its parent theme. Please fix the "Template" header.' ) ); 272 $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet ) ); 273 return; 274 }//end if 275 270 276 // (If template is set from cache [and there are no errors], we know it's good.) 271 277 if ( ! $this->template && ! ( $this->template = $this->headers['Template'] ) ) { 272 278 $this->template = $this->stylesheet; -
tests/phpunit/data/themedir1/child-parent-itself/style.css
1 /* 2 Theme Name: Child Theme 3 Template: child-parent-itself 4 */ -
tests/phpunit/tests/theme/WPTheme.php
Property changes on: tests/phpunit/data/themedir1/child-parent-itself/style.css ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property
140 140 $this->assertFalse( $theme->display( 'Tags' ) ); 141 141 } 142 142 143 /** 144 * @ticket 40820 145 */ 146 function test_child_theme_with_itself_as_parent_should_appear_as_broken() { 147 $theme = new WP_Theme( 'child-parent-itself', $this->theme_root ); 148 $errors = $theme->errors(); 149 $this->assertWPError( $errors ); 150 $this->assertEquals( 'theme_child_invalid', $errors->get_error_code() ); 151 } 152 143 153 144 154 /** 145 155 * Enable a single theme on a network. … … 217 227 218 228 $this->assertEqualSetsWithIndex( $allowed_themes, $new_allowed_themes ); 219 229 } 230 220 231 }