Code Duplication    Length = 33-33 lines in 2 locations

tests/phpunit/tests/functions.php 1 location

@@ 385-417 (lines=33) @@
382
	/**
383
	 * @ticket 23688
384
	 */
385
	function test_canonical_charset() {
386
		$orig_blog_charset = get_option( 'blog_charset' );
387
388
		update_option( 'blog_charset', 'utf8' );
389
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
390
391
		update_option( 'blog_charset', 'utf-8' );
392
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
393
394
		update_option( 'blog_charset', 'UTF8' );
395
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
396
397
		update_option( 'blog_charset', 'UTF-8' );
398
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
399
400
		update_option( 'blog_charset', 'ISO-8859-1' );
401
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
402
403
		update_option( 'blog_charset', 'ISO8859-1' );
404
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
405
406
		update_option( 'blog_charset', 'iso8859-1' );
407
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
408
409
		update_option( 'blog_charset', 'iso-8859-1' );
410
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
411
412
		// Arbitrary strings are passed through.
413
		update_option( 'blog_charset', 'foobarbaz' );
414
		$this->assertEquals( 'foobarbaz', get_option( 'blog_charset') );
415
416
		update_option( 'blog_charset', $orig_blog_charset );
417
	}
418
419
	/**
420
	 * @dataProvider data_wp_parse_id_list

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

@@ 54-86 (lines=33) @@
51
	/**
52
	 * @ticket 23688
53
	 */
54
	function test_update_option_blog_charset() {
55
		$orig_blog_charset = get_option( 'blog_charset' );
56
57
		update_option( 'blog_charset', 'utf8' );
58
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
59
60
		update_option( 'blog_charset', 'utf-8' );
61
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
62
63
		update_option( 'blog_charset', 'UTF8' );
64
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
65
66
		update_option( 'blog_charset', 'UTF-8' );
67
		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
68
69
		update_option( 'blog_charset', 'ISO-8859-1' );
70
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
71
72
		update_option( 'blog_charset', 'ISO8859-1' );
73
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
74
75
		update_option( 'blog_charset', 'iso8859-1' );
76
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
77
78
		update_option( 'blog_charset', 'iso-8859-1' );
79
		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
80
81
		// Arbitrary strings are passed through.
82
		update_option( 'blog_charset', 'foobarbaz' );
83
		$this->assertEquals( 'foobarbaz', get_option( 'blog_charset') );
84
85
		update_option( 'blog_charset', $orig_blog_charset );
86
	}
87
88
}
89