Merge "Make mediawiki.action.view.dblClickEdit recheck preference"
[lhc/web/wiklou.git] / tests / phpunit / includes / config / MultiConfigTest.php
1 <?php
2
3 class MultiConfigTest extends MediaWikiTestCase {
4
5 /**
6 * Tests that settings are fetched in the right order
7 *
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 ) );
16
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' );
21 }
22
23 /**
24 * @covers MultiConfig::has
25 */
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 ) );
32
33 $this->assertTrue( $conf->has( 'foo' ) );
34 $this->assertTrue( $conf->has( 'something' ) );
35 $this->assertTrue( $conf->has( 'meh' ) );
36 $this->assertFalse( $conf->has( 'what' ) );
37 }
38 }