Skip to content

Commit b3148f8

Browse files
committed
Added test to demonstrate that the request query value is not replaced by the default plugin value.
1 parent 9e17bab commit b3148f8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spec/Plugin/QueryDefaultsPluginSpec.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,21 @@ public function it_sets_the_default_header(RequestInterface $request, UriInterfa
3939
}, function () {
4040
});
4141
}
42+
43+
public function it_does_not_replace_existing_request_value(RequestInterface $request, UriInterface $uri)
44+
{
45+
$this->beConstructedWith([
46+
'foo' => 'fooDefault',
47+
'bar' => 'barDefault',
48+
]);
49+
50+
$request->getUri()->shouldBeCalled()->willReturn($uri);
51+
$uri->getQuery()->shouldBeCalled()->willReturn('foo=new');
52+
$uri->withQuery('foo=new&bar=barDefault')->shouldBeCalled()->willReturn($uri);
53+
$request->withUri($uri)->shouldBeCalled()->willReturn($request);
54+
55+
$this->handleRequest($request, function () {
56+
}, function () {
57+
});
58+
}
4259
}

0 commit comments

Comments
 (0)