MediaWiki REL1_33
HashConfigTest.php
Go to the documentation of this file.
1<?php
2
4
8 public function testNewInstance() {
10 $this->assertInstanceOf( HashConfig::class, $conf );
11 }
12
16 public function testConstructor() {
17 $conf = new HashConfig();
18 $this->assertInstanceOf( HashConfig::class, $conf );
19
20 // Test passing arguments to the constructor
21 $conf2 = new HashConfig( [
22 'one' => '1',
23 ] );
24 $this->assertEquals( '1', $conf2->get( 'one' ) );
25 }
26
30 public function testGet() {
31 $conf = new HashConfig( [
32 'one' => '1',
33 ] );
34 $this->assertEquals( '1', $conf->get( 'one' ) );
35 $this->setExpectedException( ConfigException::class, 'HashConfig::get: undefined option' );
36 $conf->get( 'two' );
37 }
38
42 public function testHas() {
43 $conf = new HashConfig( [
44 'one' => '1',
45 ] );
46 $this->assertTrue( $conf->has( 'one' ) );
47 $this->assertFalse( $conf->has( 'two' ) );
48 }
49
53 public function testSet() {
54 $conf = new HashConfig( [
55 'one' => '1',
56 ] );
57 $conf->set( 'two', '2' );
58 $this->assertEquals( '2', $conf->get( 'two' ) );
59 // Check that set overwrites
60 $conf->set( 'one', '3' );
61 $this->assertEquals( '3', $conf->get( 'one' ) );
62 }
63}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
testHas()
HashConfig::has.
testConstructor()
HashConfig::__construct.
testNewInstance()
HashConfig::newInstance.
testSet()
HashConfig::set.
testGet()
HashConfig::get.
A Config instance which stores all settings as a member variable.
static newInstance()