Make WordPress Core

Ticket #39005: 39005.diff

File 39005.diff, 2.4 KB (added by peterwilsoncc, 10 years ago)
  • src/wp-includes/option.php

    diff --git src/wp-includes/option.php src/wp-includes/option.php
    index aa98477..aad0830 100644
    function register_initial_settings() {  
    17371737                'description'  => __( 'Site tagline.' ),
    17381738        ) );
    17391739
    1740         register_setting( 'general', 'siteurl', array(
    1741                 'show_in_rest' => array(
     1740        if ( is_multisite() ) {
     1741                $siteurl_in_rest = false;
     1742        } else {
     1743                $siteurl_in_rest = array(
    17421744                        'name'    => 'url',
    17431745                        'schema'  => array(
    17441746                                'format' => 'uri',
    17451747                        ),
    1746                 ),
     1748                );
     1749        }
     1750
     1751        register_setting( 'general', 'siteurl', array(
     1752                'show_in_rest' => $siteurl_in_rest,
    17471753                'type'         => 'string',
    17481754                'description'  => __( 'Site URL.' ),
    17491755        ) );
  • tests/phpunit/tests/rest-api/rest-settings-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-settings-controller.php tests/phpunit/tests/rest-api/rest-settings-controller.php
    index ff91a60..bf30d31 100644
    class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase  
    5050                $response = $this->server->dispatch( $request );
    5151                $data = $response->get_data();
    5252
     53                if ( is_multisite() ) {
     54                        $expected = array(
     55                                'title',
     56                                'description',
     57                                'email',
     58                                'timezone',
     59                                'date_format',
     60                                'time_format',
     61                                'start_of_week',
     62                                'language',
     63                                'use_smilies',
     64                                'default_category',
     65                                'default_post_format',
     66                                'posts_per_page',
     67                                'default_ping_status',
     68                                'default_comment_status',
     69                        );
     70                } else {
     71                        $expected = array(
     72                                'title',
     73                                'description',
     74                                'url',
     75                                'email',
     76                                'timezone',
     77                                'date_format',
     78                                'time_format',
     79                                'start_of_week',
     80                                'language',
     81                                'use_smilies',
     82                                'default_category',
     83                                'default_post_format',
     84                                'posts_per_page',
     85                                'default_ping_status',
     86                                'default_comment_status',
     87                        );
     88                }
     89
    5390                $this->assertEquals( 200, $response->get_status() );
    54                 $this->assertEquals( array(
    55                         'title',
    56                         'description',
    57                         'url',
    58                         'email',
    59                         'timezone',
    60                         'date_format',
    61                         'time_format',
    62                         'start_of_week',
    63                         'language',
    64                         'use_smilies',
    65                         'default_category',
    66                         'default_post_format',
    67                         'posts_per_page',
    68                         'default_ping_status',
    69                         'default_comment_status',
    70                 ), array_keys( $data ) );
     91                $this->assertEquals( $expected, array_keys( $data ) );
    7192        }
    7293
    7394        public function test_get_item_value_is_cast_to_type() {