break;
}
}
+
return array(
'suffix' => $site,
'lang' => $lang,
);
}
-class SiteConfigurationTest extends PHPUnit_Framework_TestCase {
- var $mConf;
+class SiteConfigurationTest extends MediaWikiTestCase {
+
+ /**
+ * @var SiteConfiguration
+ */
+ protected $mConf;
+
+ protected function setUp() {
+ parent::setUp();
- function setUp() {
$this->mConf = new SiteConfiguration;
- $this->mConf->suffixes = array( 'wiki' );
+ $this->mConf->suffixes = array( 'wikipedia' => 'wiki' );
$this->mConf->wikis = array( 'enwiki', 'dewiki', 'frwiki' );
$this->mConf->settings = array(
'simple' => array(
$GLOBALS['global'] = array( 'global' => 'global' );
}
-
- function testSiteFromDB() {
+ /**
+ * @covers SiteConfiguration::siteFromDB
+ */
+ public function testSiteFromDb() {
$this->assertEquals(
array( 'wikipedia', 'en' ),
$this->mConf->siteFromDB( 'enwiki' ),
);
}
- function testGetLocalDatabases() {
+ /**
+ * @covers SiteConfiguration::getLocalDatabases
+ */
+ public function testGetLocalDatabases() {
$this->assertEquals(
array( 'enwiki', 'dewiki', 'frwiki' ),
$this->mConf->getLocalDatabases(),
);
}
- function testGet() {
+ /**
+ * @covers SiteConfiguration::get
+ */
+ public function testGetConfVariables() {
$this->assertEquals(
'enwiki',
$this->mConf->get( 'simple', 'enwiki', 'wiki' ),
);
}
- function testSiteFromDBWithCallback() {
+ /**
+ * @covers SiteConfiguration::siteFromDB
+ */
+ public function testSiteFromDbWithCallback() {
$this->mConf->siteParamsCallback = 'getSiteParams';
$this->assertEquals(
);
}
- function testParamReplacement() {
+ /**
+ * @covers SiteConfiguration::get
+ */
+ public function testParameterReplacement() {
$this->mConf->siteParamsCallback = 'getSiteParams';
$this->assertEquals(
);
}
- function testGetAll() {
+ /**
+ * @covers SiteConfiguration::getAll
+ */
+ public function testGetAllGlobals() {
$this->mConf->siteParamsCallback = 'getSiteParams';
$getall = array(
$this->assertEquals( $getall['simple'], $GLOBALS['simple'], 'extractAllGlobals(): simple setting' );
$this->assertEquals( $getall['fallback'], $GLOBALS['fallback'], 'extractAllGlobals(): fallback setting' );
$this->assertEquals( $getall['params'], $GLOBALS['params'], 'extractAllGlobals(): parameter replacement' );
- $this->assertEquals( $getall['global'], $GLOBALS['global'], 'extractAllGlobals(): merging with global' );
- $this->assertEquals( $getall['merge'], $GLOBALS['merge'], 'extractAllGlobals(): merging setting' );
+ $this->assertEquals( $getall['global'], $GLOBALS['global'], 'extractAllGlobals(): merging with global' );
+ $this->assertEquals( $getall['merge'], $GLOBALS['merge'], 'extractAllGlobals(): merging setting' );
}
}