Make WordPress Core

Ticket #38540: 38540.diff

File 38540.diff, 1.3 KB (added by welcher, 8 years ago)
  • src/wp-includes/theme.php

     
    17631763 */
    17641764function get_theme_starter_content() {
    17651765        $theme_support = get_theme_support( 'starter-content' );
    1766         if ( ! empty( $theme_support ) ) {
     1766        if ( is_array( $theme_support ) && ! empty( $theme_support ) ) {
    17671767                $config = $theme_support[0];
    17681768        } else {
    17691769                $config = array();
  • tests/phpunit/tests/theme/getThemeStarterContent.php

     
     1<?php
     2
     3/**
     4 * @group themes
     5 */
     6class Tests_WP_Theme_Get_Theme_Starter_Content extends WP_UnitTestCase {
     7
     8
     9        function test_add_theme_support_empty() {
     10                add_theme_support( 'starter-content', array() );
     11
     12                $starter_content = get_theme_starter_content();
     13
     14                $this->assertEmpty( $starter_content );
     15        }
     16
     17        function test_add_theme_support_single_param() {
     18                add_theme_support( 'starter-content' );
     19
     20                $starter_content = get_theme_starter_content();
     21
     22                $this->assertEmpty( $starter_content );
     23        }
     24}
     25