Merge "Break up $wgDummyLanguageCodes"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageCodeTest.php
1 <?php
2
3 /**
4 * @covers LanguageCode
5 *
6 * @group Language
7 *
8 * @license GPL-2.0+
9 * @author Thiemo Mättig
10 */
11 class LanguageCodeTest extends PHPUnit_Framework_TestCase {
12
13 public function testConstructor() {
14 $instance = new LanguageCode();
15
16 $this->assertInstanceOf( LanguageCode::class, $instance );
17 }
18
19 public function testGetDeprecatedCodeMapping() {
20 $map = LanguageCode::getDeprecatedCodeMapping();
21
22 $this->assertInternalType( 'array', $map );
23 $this->assertContainsOnly( 'string', array_keys( $map ) );
24 $this->assertArrayNotHasKey( '', $map );
25 $this->assertContainsOnly( 'string', $map );
26 $this->assertNotContains( '', $map );
27
28 // Codes special to MediaWiki should never appear in a map of "deprecated" codes
29 $this->assertArrayNotHasKey( 'qqq', $map, 'documentation' );
30 $this->assertNotContains( 'qqq', $map, 'documentation' );
31 $this->assertArrayNotHasKey( 'qqx', $map, 'debug code' );
32 $this->assertNotContains( 'qqx', $map, 'debug code' );
33
34 // Valid language codes that are currently not "deprecated"
35 $this->assertArrayNotHasKey( 'bh', $map, 'family of Bihari languages' );
36 $this->assertArrayNotHasKey( 'no', $map, 'family of Norwegian languages' );
37 $this->assertArrayNotHasKey( 'simple', $map );
38 }
39
40 }