setData() public method

assigns data to a specific path
public setData ( string $path, mixed $data ) : void
$path string the path to assign to
$data mixed the data to assign
return void
Esempio n. 1
0
 /**
  * @covers DataSift\Storyplayer\ConfigLib\WrappedConfig::getExpandedConfig()
  */
 public function testCanExpandTwigVariables()
 {
     // ----------------------------------------------------------------
     // setup your test
     // we need a config that contains a variable
     $obj = new WrappedConfig();
     $obj->loadConfigFromFile(__DIR__ . "/wrapped-config-2.json");
     $obj->setData("storyplayer.user.home", getenv("HOME"));
     $obj->setData("storyplayer.test.home", "{{storyplayer.user.home}}");
     // ----------------------------------------------------------------
     // perform the change
     $config = $obj->getExpandedConfig();
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals(getenv("HOME"), $config->storyplayer->test->home);
 }