Skip to content

Commit 93006e3

Browse files
authored
Merge pull request #7597 from kenjis/fix-AutoRouterImproved-params-not-reset
fix: [Auto Routing Improved] feature testing may use incorrect param count
2 parents 81849ed + f39530a commit 93006e3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

system/Router/AutoRouterImproved.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public function getRoute(string $uri, string $httpVerb): array
106106
{
107107
$httpVerb = strtolower($httpVerb);
108108

109+
// Reset Controller method params.
110+
$this->params = [];
111+
109112
$defaultMethod = $httpVerb . ucfirst($this->defaultMethod);
110113
$this->method = $defaultMethod;
111114

tests/system/Test/FeatureTestAutoRoutingImprovedTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,13 @@ public function testCallPost()
7272

7373
$response->assertSee('Saved');
7474
}
75+
76+
public function testCallParamsCount()
77+
{
78+
$response = $this->post('newautorouting/save/1/a/b');
79+
$response->assertSee('Saved');
80+
81+
$response = $this->get('newautorouting');
82+
$response->assertSee('Hello');
83+
}
7584
}

0 commit comments

Comments
 (0)