MediaWiki
REL1_22
|
00001 <?php 00021 abstract class LanguageClassesTestCase extends MediaWikiTestCase { 00036 private $languageObject; 00037 00041 protected function getLang() { 00042 return $this->languageObject; 00043 } 00044 00048 protected function setUp() { 00049 parent::setUp(); 00050 $found = preg_match( '/Language(.+)Test/', get_called_class(), $m ); 00051 if ( $found ) { 00052 # Normalize language code since classes uses underscores 00053 $m[1] = str_replace( '_', '-', $m[1] ); 00054 } else { 00055 # Fallback to english language 00056 $m[1] = 'en'; 00057 wfDebug( 00058 __METHOD__ . " could not extract a language name " 00059 . "out of " . get_called_class() . " failling back to 'en'\n" 00060 ); 00061 } 00062 // @todo validate $m[1] which should be a valid language code 00063 $this->languageObject = Language::factory( $m[1] ); 00064 } 00065 00070 protected function tearDown() { 00071 unset( $this->languageObject ); 00072 parent::tearDown(); 00073 } 00074 }