Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
38 lines
1,015 B
PHP
38 lines
1,015 B
PHP
<?php
|
|
|
|
class MultiConfigTest extends MediaWikiTestCase {
|
|
|
|
/**
|
|
* Tests that settings are fetched in the right order
|
|
*
|
|
* @covers MultiConfig::get
|
|
*/
|
|
public function testGet() {
|
|
$multi = new MultiConfig( [
|
|
new HashConfig( [ 'foo' => 'bar' ] ),
|
|
new HashConfig( [ 'foo' => 'baz', 'bar' => 'foo' ] ),
|
|
new HashConfig( [ 'bar' => 'baz' ] ),
|
|
] );
|
|
|
|
$this->assertEquals( 'bar', $multi->get( 'foo' ) );
|
|
$this->assertEquals( 'foo', $multi->get( 'bar' ) );
|
|
$this->setExpectedException( 'ConfigException', 'MultiConfig::get: undefined option:' );
|
|
$multi->get( 'notset' );
|
|
}
|
|
|
|
/**
|
|
* @covers MultiConfig::has
|
|
*/
|
|
public function testHas() {
|
|
$conf = new MultiConfig( [
|
|
new HashConfig( [ 'foo' => 'foo' ] ),
|
|
new HashConfig( [ 'something' => 'bleh' ] ),
|
|
new HashConfig( [ 'meh' => 'eh' ] ),
|
|
] );
|
|
|
|
$this->assertTrue( $conf->has( 'foo' ) );
|
|
$this->assertTrue( $conf->has( 'something' ) );
|
|
$this->assertTrue( $conf->has( 'meh' ) );
|
|
$this->assertFalse( $conf->has( 'what' ) );
|
|
}
|
|
}
|