MediaWiki
REL1_24
|
00001 <?php 00002 00003 class MultiConfigTest extends MediaWikiTestCase { 00004 00010 public function testGet() { 00011 $multi = new MultiConfig( array( 00012 new HashConfig( array( 'foo' => 'bar' ) ), 00013 new HashConfig( array( 'foo' => 'baz', 'bar' => 'foo' ) ), 00014 new HashConfig( array( 'bar' => 'baz' ) ), 00015 ) ); 00016 00017 $this->assertEquals( 'bar', $multi->get( 'foo' ) ); 00018 $this->assertEquals( 'foo', $multi->get( 'bar' ) ); 00019 $this->setExpectedException( 'ConfigException', 'MultiConfig::get: undefined option:' ); 00020 $multi->get( 'notset' ); 00021 } 00022 00026 public function testHas() { 00027 $conf = new MultiConfig( array( 00028 new HashConfig( array( 'foo' => 'foo' ) ), 00029 new HashConfig( array( 'something' => 'bleh' ) ), 00030 new HashConfig( array( 'meh' => 'eh' ) ), 00031 ) ); 00032 00033 $this->assertTrue( $conf->has( 'foo' ) ); 00034 $this->assertTrue( $conf->has( 'something' ) ); 00035 $this->assertTrue( $conf->has( 'meh' ) ); 00036 $this->assertFalse( $conf->has( 'what' ) ); 00037 } 00038 }