Skip to content

Commit 9050f92

Browse files
committed
fixed tests
2 parents d768aa5 + 0665ace commit 9050f92

File tree

11 files changed

+122
-40
lines changed

11 files changed

+122
-40
lines changed

Matcher/Dumper/PhpMatcherDumper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ private function generateMatchMethod($supportsRedirections)
9696
$code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n");
9797

9898
return <<<EOF
99-
public function match(\$pathinfo)
99+
public function match(\$rawPathinfo)
100100
{
101101
\$allow = array();
102-
\$pathinfo = rawurldecode(\$pathinfo);
102+
\$pathinfo = rawurldecode(\$rawPathinfo);
103103
\$trimmedPathinfo = rtrim(\$pathinfo, '/');
104104
\$context = \$this->context;
105105
\$request = \$this->request;
@@ -362,7 +362,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
362362
if ($hasTrailingSlash) {
363363
$code .= <<<EOF
364364
if (substr(\$pathinfo, -1) !== '/') {
365-
return array_replace(\$ret, \$this->redirect(\$pathinfo.'/', '$name'));
365+
return array_replace(\$ret, \$this->redirect(\$rawPathinfo.'/', '$name'));
366366
}
367367
368368
@@ -377,7 +377,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
377377
$code .= <<<EOF
378378
\$requiredSchemes = $schemes;
379379
if (!isset(\$requiredSchemes[\$scheme])) {
380-
return array_replace(\$ret, \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes)));
380+
return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
381381
}
382382
383383

Tests/Fixtures/dumper/url_matcher0.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;

Tests/Fixtures/dumper/url_matcher1.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;

Tests/Fixtures/dumper/url_matcher2.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;
@@ -84,7 +84,7 @@ public function match($pathinfo)
8484
if ('/test/baz3' === $trimmedPathinfo) {
8585
$ret = array('_route' => 'baz3');
8686
if (substr($pathinfo, -1) !== '/') {
87-
return array_replace($ret, $this->redirect($pathinfo.'/', 'baz3'));
87+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz3'));
8888
}
8989

9090
return $ret;
@@ -96,7 +96,7 @@ public function match($pathinfo)
9696
if (preg_match('#^/test/(?P<foo>[^/]++)/?$#s', $pathinfo, $matches)) {
9797
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
9898
if (substr($pathinfo, -1) !== '/') {
99-
return array_replace($ret, $this->redirect($pathinfo.'/', 'baz4'));
99+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz4'));
100100
}
101101

102102
return $ret;
@@ -180,7 +180,7 @@ public function match($pathinfo)
180180
if ('/multi/hey' === $trimmedPathinfo) {
181181
$ret = array('_route' => 'hey');
182182
if (substr($pathinfo, -1) !== '/') {
183-
return array_replace($ret, $this->redirect($pathinfo.'/', 'hey'));
183+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'hey'));
184184
}
185185

186186
return $ret;
@@ -327,7 +327,7 @@ public function match($pathinfo)
327327
$ret = array('_route' => 'secure');
328328
$requiredSchemes = array ( 'https' => 0,);
329329
if (!isset($requiredSchemes[$scheme])) {
330-
return array_replace($ret, $this->redirect($pathinfo, 'secure', key($requiredSchemes)));
330+
return array_replace($ret, $this->redirect($rawPathinfo, 'secure', key($requiredSchemes)));
331331
}
332332

333333
return $ret;
@@ -338,7 +338,7 @@ public function match($pathinfo)
338338
$ret = array('_route' => 'nonsecure');
339339
$requiredSchemes = array ( 'http' => 0,);
340340
if (!isset($requiredSchemes[$scheme])) {
341-
return array_replace($ret, $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)));
341+
return array_replace($ret, $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes)));
342342
}
343343

344344
return $ret;

Tests/Fixtures/dumper/url_matcher3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;

Tests/Fixtures/dumper/url_matcher4.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;

Tests/Fixtures/dumper/url_matcher5.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;
@@ -58,7 +58,7 @@ public function match($pathinfo)
5858
if ('/a/44' === $trimmedPathinfo) {
5959
$ret = array('_route' => 'a_fourth');
6060
if (substr($pathinfo, -1) !== '/') {
61-
return array_replace($ret, $this->redirect($pathinfo.'/', 'a_fourth'));
61+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fourth'));
6262
}
6363

6464
return $ret;
@@ -68,7 +68,7 @@ public function match($pathinfo)
6868
if ('/a/55' === $trimmedPathinfo) {
6969
$ret = array('_route' => 'a_fifth');
7070
if (substr($pathinfo, -1) !== '/') {
71-
return array_replace($ret, $this->redirect($pathinfo.'/', 'a_fifth'));
71+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fifth'));
7272
}
7373

7474
return $ret;
@@ -78,7 +78,7 @@ public function match($pathinfo)
7878
if ('/a/66' === $trimmedPathinfo) {
7979
$ret = array('_route' => 'a_sixth');
8080
if (substr($pathinfo, -1) !== '/') {
81-
return array_replace($ret, $this->redirect($pathinfo.'/', 'a_sixth'));
81+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_sixth'));
8282
}
8383

8484
return $ret;
@@ -96,7 +96,7 @@ public function match($pathinfo)
9696
if ('/nested/group/a' === $trimmedPathinfo) {
9797
$ret = array('_route' => 'nested_a');
9898
if (substr($pathinfo, -1) !== '/') {
99-
return array_replace($ret, $this->redirect($pathinfo.'/', 'nested_a'));
99+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_a'));
100100
}
101101

102102
return $ret;
@@ -106,7 +106,7 @@ public function match($pathinfo)
106106
if ('/nested/group/b' === $trimmedPathinfo) {
107107
$ret = array('_route' => 'nested_b');
108108
if (substr($pathinfo, -1) !== '/') {
109-
return array_replace($ret, $this->redirect($pathinfo.'/', 'nested_b'));
109+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_b'));
110110
}
111111

112112
return $ret;
@@ -116,7 +116,7 @@ public function match($pathinfo)
116116
if ('/nested/group/c' === $trimmedPathinfo) {
117117
$ret = array('_route' => 'nested_c');
118118
if (substr($pathinfo, -1) !== '/') {
119-
return array_replace($ret, $this->redirect($pathinfo.'/', 'nested_c'));
119+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_c'));
120120
}
121121

122122
return $ret;
@@ -129,7 +129,7 @@ public function match($pathinfo)
129129
if ('/slashed/group' === $trimmedPathinfo) {
130130
$ret = array('_route' => 'slashed_a');
131131
if (substr($pathinfo, -1) !== '/') {
132-
return array_replace($ret, $this->redirect($pathinfo.'/', 'slashed_a'));
132+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_a'));
133133
}
134134

135135
return $ret;
@@ -139,7 +139,7 @@ public function match($pathinfo)
139139
if ('/slashed/group/b' === $trimmedPathinfo) {
140140
$ret = array('_route' => 'slashed_b');
141141
if (substr($pathinfo, -1) !== '/') {
142-
return array_replace($ret, $this->redirect($pathinfo.'/', 'slashed_b'));
142+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_b'));
143143
}
144144

145145
return $ret;
@@ -149,7 +149,7 @@ public function match($pathinfo)
149149
if ('/slashed/group/c' === $trimmedPathinfo) {
150150
$ret = array('_route' => 'slashed_c');
151151
if (substr($pathinfo, -1) !== '/') {
152-
return array_replace($ret, $this->redirect($pathinfo.'/', 'slashed_c'));
152+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_c'));
153153
}
154154

155155
return $ret;

Tests/Fixtures/dumper/url_matcher6.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;

Tests/Fixtures/dumper/url_matcher7.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
1515
$this->context = $context;
1616
}
1717

18-
public function match($pathinfo)
18+
public function match($rawPathinfo)
1919
{
2020
$allow = array();
21-
$pathinfo = rawurldecode($pathinfo);
21+
$pathinfo = rawurldecode($rawPathinfo);
2222
$trimmedPathinfo = rtrim($pathinfo, '/');
2323
$context = $this->context;
2424
$request = $this->request;
@@ -35,7 +35,7 @@ public function match($pathinfo)
3535
if ('/trailing/simple/no-methods' === $trimmedPathinfo) {
3636
$ret = array('_route' => 'simple_trailing_slash_no_methods');
3737
if (substr($pathinfo, -1) !== '/') {
38-
return array_replace($ret, $this->redirect($pathinfo.'/', 'simple_trailing_slash_no_methods'));
38+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods'));
3939
}
4040

4141
return $ret;
@@ -50,7 +50,7 @@ public function match($pathinfo)
5050

5151
$ret = array('_route' => 'simple_trailing_slash_GET_method');
5252
if (substr($pathinfo, -1) !== '/') {
53-
return array_replace($ret, $this->redirect($pathinfo.'/', 'simple_trailing_slash_GET_method'));
53+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method'));
5454
}
5555

5656
return $ret;
@@ -66,7 +66,7 @@ public function match($pathinfo)
6666

6767
$ret = array('_route' => 'simple_trailing_slash_HEAD_method');
6868
if (substr($pathinfo, -1) !== '/') {
69-
return array_replace($ret, $this->redirect($pathinfo.'/', 'simple_trailing_slash_HEAD_method'));
69+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_HEAD_method'));
7070
}
7171

7272
return $ret;
@@ -91,7 +91,7 @@ public function match($pathinfo)
9191
if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/?$#s', $pathinfo, $matches)) {
9292
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
9393
if (substr($pathinfo, -1) !== '/') {
94-
return array_replace($ret, $this->redirect($pathinfo.'/', 'regex_trailing_slash_no_methods'));
94+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods'));
9595
}
9696

9797
return $ret;
@@ -106,7 +106,7 @@ public function match($pathinfo)
106106

107107
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
108108
if (substr($pathinfo, -1) !== '/') {
109-
return array_replace($ret, $this->redirect($pathinfo.'/', 'regex_trailing_slash_GET_method'));
109+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method'));
110110
}
111111

112112
return $ret;
@@ -122,7 +122,7 @@ public function match($pathinfo)
122122

123123
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
124124
if (substr($pathinfo, -1) !== '/') {
125-
return array_replace($ret, $this->redirect($pathinfo.'/', 'regex_trailing_slash_HEAD_method'));
125+
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_HEAD_method'));
126126
}
127127

128128
return $ret;

0 commit comments

Comments
 (0)