3 class MultiConfigTest
extends MediaWikiTestCase
{
6 * Tests that settings are fetched in the right order
8 * @covers MultiConfig::get
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' ] ),
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' );
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' ] ),
33 $this->assertTrue( $conf->has( 'foo' ) );
34 $this->assertTrue( $conf->has( 'something' ) );
35 $this->assertTrue( $conf->has( 'meh' ) );
36 $this->assertFalse( $conf->has( 'what' ) );