3 class MultiConfigTest
extends MediaWikiTestCase
{
6 * Tests that settings are fetched in the right order
8 * @covers MultiConfig::__construct
9 * @covers MultiConfig::get
11 public function testGet() {
12 $multi = new MultiConfig( [
13 new HashConfig( [ 'foo' => 'bar' ] ),
14 new HashConfig( [ 'foo' => 'baz', 'bar' => 'foo' ] ),
15 new HashConfig( [ 'bar' => 'baz' ] ),
18 $this->assertEquals( 'bar', $multi->get( 'foo' ) );
19 $this->assertEquals( 'foo', $multi->get( 'bar' ) );
20 $this->setExpectedException( ConfigException
::class, 'MultiConfig::get: undefined option:' );
21 $multi->get( 'notset' );
25 * @covers MultiConfig::has
27 public function testHas() {
28 $conf = new MultiConfig( [
29 new HashConfig( [ 'foo' => 'foo' ] ),
30 new HashConfig( [ 'something' => 'bleh' ] ),
31 new HashConfig( [ 'meh' => 'eh' ] ),
34 $this->assertTrue( $conf->has( 'foo' ) );
35 $this->assertTrue( $conf->has( 'something' ) );
36 $this->assertTrue( $conf->has( 'meh' ) );
37 $this->assertFalse( $conf->has( 'what' ) );