Skip to content

Commit

Permalink
Possibility to change real variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sieg committed May 20, 2017
1 parent 0ffb7b4 commit d2afe1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Source/DataContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public function setData($data)
$this->data = $data;
}

/**
* Set data as reference
*
* @param mixed $value
*/
public function setDataReference(&$reference)
{
$this->data = &$reference;
}

/**
* Separator getter
*
Expand Down
9 changes: 9 additions & 0 deletions Tests/DataContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ public function testSetData()
$this->assertEquals($changedData, $result);
}

public function testSetDataReference()
{
$testDataAccess = new DataContainer();
$testDataAccess->setDataReference($this->arrayExample);

$testDataAccess->set("key3.key31", "othervalue31");
$this->assertEquals($this->arrayExample, $testDataAccess->getData());
}

public function testResetLevel0Data()
{
$testData = $this->arrayExample;
Expand Down

0 comments on commit d2afe1c

Please sign in to comment.