DataSift\Storyplayer\ConfigLib\WrappedConfigTest::testCanMergeAnArray PHP Method

testCanMergeAnArray() public method

public testCanMergeAnArray ( )
    public function testCanMergeAnArray()
    {
        // ----------------------------------------------------------------
        // setup your test
        $obj = new WrappedConfig();
        $obj->loadConfigFromFile(__DIR__ . "/wrapped-config-2.json");
        $dataToMerge = ["home" => getenv("HOME")];
        // ----------------------------------------------------------------
        // perform the change
        $obj->mergeData("storyplayer.dirs", $dataToMerge);
        // ----------------------------------------------------------------
        // test the results
        $config = $obj->getConfig();
        // this is the data we have merged
        $this->assertTrue(is_array($config->storyplayer->dirs));
        $this->assertEquals(getenv("HOME"), $config->storyplayer->dirs["home"]);
        // this is data loaded from the config file
        $this->assertEquals("test-user", $config->storyplayer->user->name);
    }
WrappedConfigTest