Skip to content

Commit

Permalink
Add test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 2, 2020
1 parent 0394a39 commit 0a20a78
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/TestCase/View/Helper/SearchHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,37 @@ public function testResetUrl()
$this->assertSame($expected, $result);
}

/**
* @return void
*/
public function testResetUrlWithPassedParams()
{
$request = new ServerRequest([
'url' => '/controller/action/my-passed?limit=5&sort=x&direction=asc&foo=baz&bar=1',
]);
$request = $request->withParam('pass', ['my-passed']);

$this->view = new View($request);
$this->searchHelper = new SearchHelper($this->view, []);

$params = [
'foo' => 'baz',
'bar' => '1',
];
$this->view->set('_searchParams', $params);

$result = $this->searchHelper->resetUrl();
$expected = [
'my-passed',
'?' => [
'limit' => '5',
'sort' => 'x',
'direction' => 'asc',
],
];
$this->assertSame($expected, $result);
}

/**
* @return void
*/
Expand Down

0 comments on commit 0a20a78

Please sign in to comment.