Skip to content

Commit

Permalink
Components\Filters: Fixed setDefaultValue() method
Browse files Browse the repository at this point in the history
  • Loading branch information
o5 committed Oct 21, 2014
1 parent 3ff769b commit 73b2d1d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Grido/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function setDefaultPerPage($perPage)
*/
public function setDefaultFilter(array $filter)
{
$this->defaultFilter = $filter;
$this->defaultFilter = array_merge($this->defaultFilter, $filter);
return $this;
}

Expand Down
4 changes: 4 additions & 0 deletions tests/Grido/Components/Filter.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class FilterTest extends \Tester\TestCase
$grid->addFilterText('filter', 'Filter')
->setDefaultValue('default');
Assert::same(array('filter' => 'default'), $grid->defaultFilter);

$grid->addFilterText('filter2', 'Filter2')
->setDefaultValue('default2');
Assert::same(array('filter' => 'default', 'filter2' => 'default2'), $grid->defaultFilter);
}

function testGetWrapperPrototype()
Expand Down
4 changes: 0 additions & 4 deletions tests/Grido/Grid/Grid.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ class GridTest extends \Tester\TestCase
{
$grid = new Grid;

Assert::error(function() use ($grid) {
$grid->setDefaultFilter('');
}, E_RECOVERABLE_ERROR);

$data = array(
array('A' => 'A1', 'B' => 'B1'),
array('A' => 'A2', 'B' => 'B2'),
Expand Down

0 comments on commit 73b2d1d

Please sign in to comment.