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

testCanSetDataByExtendingTheConfig() public method

    public function testCanSetDataByExtendingTheConfig()
    {
        // ----------------------------------------------------------------
        // setup your test
        $obj = new WrappedConfig();
        $obj->loadConfigFromFile(__DIR__ . "/wrapped-config-2.json");
        $this->assertFalse(isset($obj->getConfig()->storyplayer->roles[1]));
        // ----------------------------------------------------------------
        // perform the change
        $obj->setData("storyplayer.dirs.cwd", getcwd());
        $obj->setData("storyplayer.roles.1.homedir", getenv("HOME"));
        $obj->setData("storyplayer.user.env.homedir", getenv("HOME"));
        // ----------------------------------------------------------------
        // test the results
        $config = $obj->getConfig();
        $this->assertTrue($config instanceof BaseObject);
        $this->assertTrue($config->storyplayer instanceof BaseObject);
        $this->assertTrue(is_array($config->storyplayer->dirs));
        $this->assertEquals(getcwd(), $config->storyplayer->dirs["cwd"]);
        $this->assertTrue($config->storyplayer->roles[1] instanceof BaseObject);
        $this->assertEquals(getenv("HOME"), $config->storyplayer->roles[1]->homedir);
        $this->assertTrue(isset($config->storyplayer->user->env));
        $this->assertEquals(getenv("HOME"), $config->storyplayer->user->env->homedir);
    }
WrappedConfigTest