Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / config / MultiConfigTest.php
blob158da466ef9ec506ed8afc6d3d0a2088004a41da
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( array(
12 new HashConfig( array( 'foo' => 'bar' ) ),
13 new HashConfig( array( 'foo' => 'baz', 'bar' => 'foo' ) ),
14 new HashConfig( array( '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( array(
28 new HashConfig( array( 'foo' => 'foo' ) ),
29 new HashConfig( array( 'something' => 'bleh' ) ),
30 new HashConfig( array( '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' ) );