Skip to content

Commit

Permalink
Merge pull request #11 from sheridans/hotfix/reuse_query_params_default
Browse files Browse the repository at this point in the history
hotfix/reuse_query_params_default
  • Loading branch information
weierophinney committed Apr 21, 2021
2 parents 3ceaaa5 + 92129ac commit c9120ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/UrlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function __invoke(
$routeParams = $this->mergeParams($routeName, $result, $routeParams);
}

$reuseQueryParams = ! isset($options['reuse_query_params']) || (bool) $options['reuse_query_params'];
$reuseQueryParams = isset($options['reuse_query_params']) ? (bool) $options['reuse_query_params'] : false;

if ($result && $reuseQueryParams) {
// Merge current request params with passed query params
Expand Down
4 changes: 2 additions & 2 deletions test/UrlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public function testWillReuseQueryParamsIfReuseQueryParamsFlagIsTrueWhenGenerati
$this->assertEquals('URL?foo=bar', $helper('resource', [], [], null, ['reuse_query_params' => true]));
}

public function testWillReuseQueryParamsIfReuseQueryParamsFlagIsMissingGeneratingUri()
public function testWillNotReuseQueryParamsIfReuseQueryParamsFlagIsMissingGeneratingUri()
{
$result = $this->prophesize(RouteResult::class);
$result->isFailure()->willReturn(false);
Expand All @@ -459,7 +459,7 @@ public function testWillReuseQueryParamsIfReuseQueryParamsFlagIsMissingGeneratin
$helper->setRouteResult($result->reveal());
$helper->setRequest($request->reveal());

$this->assertEquals('URL?foo=bar', $helper('resource'));
$this->assertEquals('URL', $helper('resource'));
}

public function testCanOverrideRequestQueryParams()
Expand Down

0 comments on commit c9120ed

Please sign in to comment.