public function testQueryModify() { $test_uri = '/test?query'; $query_string = 'search=string&page=2&per_page=3'; $test_one = ''; $test_two = ''; $test_three = ''; $request = new Request(); $request->server()->set('REQUEST_URI', $test_uri); $request->server()->set('QUERY_STRING', $query_string); $this->klein_app->respond(function ($request, $response, $service) use(&$test_one, &$test_two, &$test_three) { // Add a new var $test_one = $request->query('test', 'dog'); // Modify a current var $test_two = $request->query('page', 7); // Modify a current var $test_three = $request->query(array('per_page' => 10)); }); $this->klein_app->dispatch($request); $expected_uri = parse_url($this->klein_app->request()->uri(), PHP_URL_PATH); $this->assertSame($expected_uri . '?' . $query_string . '&test=dog', $test_one); $this->assertSame($expected_uri . '?' . str_replace('page=2', 'page=7', $query_string), $test_two); $this->assertSame($expected_uri . '?' . str_replace('per_page=3', 'per_page=10', $query_string), $test_three); }