Code Duplication    Length = 33-33 lines in 2 locations

tests/phpunit/tests/functions.php 1 location

@@ 417-449 (lines=33) @@
414
    /**
415
     * @ticket 23688
416
     */
417
    function test_canonical_charset() 
418
    {
419
        $orig_blog_charset = get_option('blog_charset');
420
421
        update_option('blog_charset', 'utf8');
422
        $this->assertEquals('UTF-8', get_option('blog_charset'));
423
424
        update_option('blog_charset', 'utf-8');
425
        $this->assertEquals('UTF-8', get_option('blog_charset'));
426
427
        update_option('blog_charset', 'UTF8');
428
        $this->assertEquals('UTF-8', get_option('blog_charset'));
429
430
        update_option('blog_charset', 'UTF-8');
431
        $this->assertEquals('UTF-8', get_option('blog_charset'));
432
433
        update_option('blog_charset', 'ISO-8859-1');
434
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
435
436
        update_option('blog_charset', 'ISO8859-1');
437
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
438
439
        update_option('blog_charset', 'iso8859-1');
440
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
441
442
        update_option('blog_charset', 'iso-8859-1');
443
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
444
445
        // Arbitrary strings are passed through.
446
        update_option('blog_charset', 'foobarbaz');
447
        $this->assertEquals('foobarbaz', get_option('blog_charset'));
448
449
        update_option('blog_charset', $orig_blog_charset);
450
    }
451
452
    /**

tests/phpunit/tests/functions/canonical-charset.php 1 location

@@ 65-97 (lines=33) @@
62
    /**
63
     * @ticket 23688
64
     */
65
    function test_update_option_blog_charset() 
66
    {
67
        $orig_blog_charset = get_option('blog_charset');
68
69
        update_option('blog_charset', 'utf8');
70
        $this->assertEquals('UTF-8', get_option('blog_charset'));
71
72
        update_option('blog_charset', 'utf-8');
73
        $this->assertEquals('UTF-8', get_option('blog_charset'));
74
75
        update_option('blog_charset', 'UTF8');
76
        $this->assertEquals('UTF-8', get_option('blog_charset'));
77
78
        update_option('blog_charset', 'UTF-8');
79
        $this->assertEquals('UTF-8', get_option('blog_charset'));
80
81
        update_option('blog_charset', 'ISO-8859-1');
82
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
83
84
        update_option('blog_charset', 'ISO8859-1');
85
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
86
87
        update_option('blog_charset', 'iso8859-1');
88
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
89
90
        update_option('blog_charset', 'iso-8859-1');
91
        $this->assertEquals('ISO-8859-1', get_option('blog_charset'));
92
93
        // Arbitrary strings are passed through.
94
        update_option('blog_charset', 'foobarbaz');
95
        $this->assertEquals('foobarbaz', get_option('blog_charset'));
96
97
        update_option('blog_charset', $orig_blog_charset);
98
    }
99
100
}