Make WordPress Core


Ignore:
Timestamp:
12/16/2016 06:43:48 AM (9 years ago)
Author:
dd32
Message:

Feeds: Do not translate the lastBuildDate field in RSS feeds.

Props stevenkword.
Partial Merge of [39613] to the 4.7 branch.
Fixes #39141.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/tests/phpunit/tests/feed/rss2.php

    r38929 r39615  
    137137
    138138    /**
     139     * Test that translated feeds have a valid listed date.
     140     * @group 39141
     141     */
     142    function test_channel_pubdate_element_translated() {
     143        $original_locale = $GLOBALS['wp_locale'];
     144        /* @var WP_Locale $locale */
     145        $locale = clone $GLOBALS['wp_locale'];
     146
     147        $locale->weekday[2] = 'Tuesday_Translated';
     148        $locale->weekday_abbrev[ 'Tuesday_Translated' ] = 'Tue_Translated';
     149
     150        $GLOBALS['wp_locale'] = $locale;
     151
     152        $this->go_to( '/?feed=rss2' );
     153        $feed = $this->do_rss2();
     154
     155        // Restore original locale.
     156        $GLOBALS['wp_locale'] = $original_locale;
     157
     158        $xml = xml_to_array( $feed );
     159
     160        // Verify the date is untranslated.
     161        $pubdate = xml_find( $xml, 'rss', 'channel', 'lastBuildDate' );
     162        $this->assertNotContains( 'Tue_Translated', $pubdate[0]['content'] );
     163    }
     164
     165    /**
    139166     * @ticket UT32
    140167     */
Note: See TracChangeset for help on using the changeset viewer.