Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/ZF2-460' of https://github.com/pdobrigkeit/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Model/ViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ public function __unset($name)
return null;
}

$variables = $this->getVariables();
unset($variables[$name]);
unset($this->variables[$name]);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions test/Model/ViewModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ public function testSetVariablesMergesWithPreviouslyStoredVariables()
$this->assertEquals(array('foo' => 'bar', 'bar' => 'BAZBAT'), $model->getVariables());
}

public function testCanUnsetVariable()
{
$model = new ViewModel(array('foo' => 'bar'));
$model->__unset('foo');
$this->assertEquals(array(), $model->getVariables());
}

public function testCanSetOptionsSingly()
{
$model = new ViewModel(array(), array('foo' => 'bar'));
Expand Down

0 comments on commit 9e4090a

Please sign in to comment.