Make WordPress Core

Changeset 1298 in tests


Ignore:
Timestamp:
06/25/2013 07:04:09 PM (12 years ago)
Author:
ryan
Message:

Tests for charset string normalization. see #23688

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/functions.php

    r1238 r1298  
    300300        $this->assertEquals( $mimes2, $mimes );
    301301    }
     302
     303    /**
     304     * @ticket 23688
     305     */
     306    function test_canonical_charset() {
     307        $orig_blog_charset = get_option( 'blog_charset' );
     308
     309        update_option( 'blog_charset', 'utf8' );
     310        $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     311
     312        update_option( 'blog_charset', 'utf-8' );
     313        $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     314
     315        update_option( 'blog_charset', 'UTF8' );
     316        $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     317
     318        update_option( 'blog_charset', 'UTF-8' );
     319        $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     320
     321        update_option( 'blog_charset', 'ISO-8859-1' );
     322        $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     323
     324        update_option( 'blog_charset', 'ISO8859-1' );
     325        $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     326
     327        update_option( 'blog_charset', 'iso8859-1' );
     328        $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     329
     330        update_option( 'blog_charset', 'iso-8859-1' );
     331        $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     332
     333        // Arbitrary strings are passed through.
     334        update_option( 'blog_charset', 'foobarbaz' );
     335        $this->assertEquals( 'foobarbaz', get_option( 'blog_charset') );
     336
     337        update_option( 'blog_charset', $orig_blog_charset );
     338    }
    302339}
Note: See TracChangeset for help on using the changeset viewer.