| @@ 2057-2075 (lines=19) @@ | ||
| 2054 | * https://github.com/sinatra/sinatra/blob/cd82a57154d57c18acfadbfefbefc6ea6a5035af/test/routing_test.rb |
|
| 2055 | */ |
|
| 2056 | ||
| 2057 | public function testMatchesEncodedSlashes() |
|
| 2058 | { |
|
| 2059 | $this->klein_app->respond( |
|
| 2060 | '/[:a]', |
|
| 2061 | function ($request) { |
|
| 2062 | return $request->param('a'); |
|
| 2063 | } |
|
| 2064 | ); |
|
| 2065 | ||
| 2066 | $this->klein_app->dispatch( |
|
| 2067 | MockRequestFactory::create('/foo%2Fbar'), |
|
| 2068 | null, |
|
| 2069 | true, |
|
| 2070 | Klein::DISPATCH_CAPTURE_AND_RETURN |
|
| 2071 | ); |
|
| 2072 | ||
| 2073 | $this->assertSame(200, $this->klein_app->response()->code()); |
|
| 2074 | $this->assertSame('foo/bar', $this->klein_app->response()->body()); |
|
| 2075 | } |
|
| 2076 | ||
| 2077 | public function testMatchesDotAsNamedParam() |
|
| 2078 | { |
|
| @@ 2077-2095 (lines=19) @@ | ||
| 2074 | $this->assertSame('foo/bar', $this->klein_app->response()->body()); |
|
| 2075 | } |
|
| 2076 | ||
| 2077 | public function testMatchesDotAsNamedParam() |
|
| 2078 | { |
|
| 2079 | $this->klein_app->respond( |
|
| 2080 | '/[:foo]/[:bar]', |
|
| 2081 | function ($request) { |
|
| 2082 | return $request->param('foo'); |
|
| 2083 | } |
|
| 2084 | ); |
|
| 2085 | ||
| 2086 | $this->klein_app->dispatch( |
|
| 2087 | MockRequestFactory::create('/[email protected]/name'), |
|
| 2088 | null, |
|
| 2089 | true, |
|
| 2090 | Klein::DISPATCH_CAPTURE_AND_RETURN |
|
| 2091 | ); |
|
| 2092 | ||
| 2093 | $this->assertSame(200, $this->klein_app->response()->code()); |
|
| 2094 | $this->assertSame('[email protected]', $this->klein_app->response()->body()); |
|
| 2095 | } |
|
| 2096 | ||
| 2097 | public function testMatchesDotOutsideOfNamedParam() |
|
| 2098 | { |
|