Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / tests / phpunit / includes / config / MultiConfigTest.php
blobbc6d6eb2e032ac921be2b47267bee05969501339
1 <?php
3 class MultiConfigTest extends MediaWikiTestCase {
5 /**
6 * Tests that settings are fetched in the right order
8 * @covers MultiConfig::get
9 */
10 public function testGet() {
11 $multi = new MultiConfig( [
12 new HashConfig( [ 'foo' => 'bar' ] ),
13 new HashConfig( [ 'foo' => 'baz', 'bar' => 'foo' ] ),
14 new HashConfig( [ 'bar' => 'baz' ] ),
15 ] );
17 $this->assertEquals( 'bar', $multi->get( 'foo' ) );
18 $this->assertEquals( 'foo', $multi->get( 'bar' ) );
19 $this->setExpectedException( 'ConfigException', 'MultiConfig::get: undefined option:' );
20 $multi->get( 'notset' );
23 /**
24 * @covers MultiConfig::has
26 public function testHas() {
27 $conf = new MultiConfig( [
28 new HashConfig( [ 'foo' => 'foo' ] ),
29 new HashConfig( [ 'something' => 'bleh' ] ),
30 new HashConfig( [ 'meh' => 'eh' ] ),
31 ] );
33 $this->assertTrue( $conf->has( 'foo' ) );
34 $this->assertTrue( $conf->has( 'something' ) );
35 $this->assertTrue( $conf->has( 'meh' ) );
36 $this->assertFalse( $conf->has( 'what' ) );