MediaWikiLangTestCase.php 713 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. use MediaWiki\MediaWikiServices;
  3. /**
  4. * Base class that store and restore the Language objects
  5. */
  6. abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
  7. protected function setUp() {
  8. global $wgLanguageCode;
  9. $contLang = MediaWikiServices::getInstance()->getContentLanguage();
  10. if ( $wgLanguageCode != $contLang->getCode() ) {
  11. throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
  12. "\$wgLanguageCode ('$wgLanguageCode') is different from content language code (" .
  13. $contLang->getCode() . ")" );
  14. }
  15. parent::setUp();
  16. $this->setUserLang( 'en' );
  17. // For mainpage to be 'Main Page'
  18. $this->setContentLang( 'en' );
  19. MessageCache::singleton()->disable();
  20. }
  21. }