fix bug with expected class type
[m6w6/merry] / tests / merry / ConfigTest.php
1 <?php
2
3 namespace merry;
4
5 require __DIR__."/../../vendor/autoload.php";
6
7 /**
8 * @covers merry\Config
9 */
10 class ConfigTest extends \PHPUnit_Framework_TestCase
11 {
12 public function testBasicSection() {
13 $config = [
14 "primary" => [
15 "foo" => "bar",
16 "bar" => "foo",
17 ],
18 "secondary : primary" => [
19 "bar" => "foo2",
20 "baz" => "sec"
21 ],
22 "tertiary : secondary" => [
23 "bar" => "foo3",
24 "bat" => "tri"
25 ],
26 "alternative : primary" => [
27 "bar" => "fux",
28 "baz" => "alt"
29 ]
30 ];
31 $object = new Config($config, "primary");
32 $this->assertEquals($config["primary"], $object->toArray());
33
34 $object = new Config($config, "secondary");
35 $this->assertEquals($config["secondary : primary"] + $config["primary"], $object->toArray());
36
37 $object = new Config($config, "tertiary");
38 $this->assertEquals($config["tertiary : secondary"] + $config["secondary : primary"] + $config["primary"], $object->toArray());
39
40 $object = new Config($config, "alternative");
41 $this->assertEquals($config["alternative : primary"] + $config["primary"], $object->toArray());
42 }
43 }