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

testCanSetDataInsideAnArray() public method

    public function testCanSetDataInsideAnArray()
    {
        // ----------------------------------------------------------------
        // setup your test
        $obj = new WrappedConfig();
        $obj->loadConfigFromFile(__DIR__ . "/wrapped-config-2.json");
        $this->assertTrue(is_array($obj->getConfig()->storyplayer->roles));
        $this->assertTrue(is_object($obj->getConfig()->storyplayer->roles[0]));
        // ----------------------------------------------------------------
        // perform the change
        $obj->setData("storyplayer.roles.0", getenv("HOME"));
        // ----------------------------------------------------------------
        // test the results
        $config = $obj->getConfig();
        $this->assertTrue($config instanceof BaseObject);
        $this->assertTrue($config->storyplayer instanceof BaseObject);
        $this->assertEquals(getenv("HOME"), $config->storyplayer->roles[0]);
    }
WrappedConfigTest