From 1a47d4f5e45bd2e60a128dd9fb115bbbd8edb3ee Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sat, 13 Sep 2014 19:14:18 -0400 Subject: [PATCH] Fix loss of query params in Router and unit test --- src/Ratchet/Http/Router.php | 2 ++ tests/unit/Http/RouterTest.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Ratchet/Http/Router.php b/src/Ratchet/Http/Router.php index 817f6a8..bfc8193 100644 --- a/src/Ratchet/Http/Router.php +++ b/src/Ratchet/Http/Router.php @@ -53,6 +53,8 @@ class Router implements HttpServerInterface { $parameters[$key] = $value; } } + $parameters = array_merge($parameters, $request->getQuery()->getAll()); + $url = Url::factory($request->getPath()); $url->setQuery($parameters); $request->setUrl($url); diff --git a/tests/unit/Http/RouterTest.php b/tests/unit/Http/RouterTest.php index 412e774..3615be0 100644 --- a/tests/unit/Http/RouterTest.php +++ b/tests/unit/Http/RouterTest.php @@ -15,8 +15,18 @@ class RouterTest extends \PHPUnit_Framework_TestCase { protected $_req; public function setUp() { + $queryMock = $this->getMock('Guzzle\Http\QueryString'); + $queryMock + ->expects($this->any()) + ->method('getAll') + ->will($this->returnValue(array())); + $this->_conn = $this->getMock('\Ratchet\ConnectionInterface'); $this->_req = $this->getMock('\Guzzle\Http\Message\RequestInterface'); + $this->_req + ->expects($this->any()) + ->method('getQuery') + ->will($this->returnValue($queryMock)); $this->_matcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); $this->_matcher ->expects($this->any())