![]() |
06-04-2023, 09:25 AM
(This post was last modified: 06-05-2023, 06:13 AM by massimiliano1.mancini.)
Hi,
I'm new in the forum and I hope this is the right place to request some support for the following issue. Following the guidelines concerning autorouting improved, I have a controller with two different methods: PHP Code: getCreate() during testing HTTP Feature if I call PHP Code: $result = $this->post('section/create', $dataPost); As workaround, I added a route in my test PHP Code: $routes = [ PHP Code: $result = $this->withRoutes($routes)->post('section/create', $dataPost); Am I doing something wrong? Or there is a problem with autorouting and HTTP Feature test? Thenk you, Massimiliano
It seems there is a bug that caches HTTP verb when HTTP testing.
06-19-2023, 12:04 AM
(This post was last modified: 06-19-2023, 01:04 AM by massimiliano1.mancini.)
Back to this thread. After release 4.3.6 that accepted the specific pull request to solve the verb issue, I tried to remove from my test the routes and I still have a problem.
When a test with parameters comes before a test without parameters, as in the example below: PHP Code: public function testUpdateButton() Code: 1) CodeIgniter\SectionTest::testAbort What I found is that the parameter is not reset from first call to the second. The second call do not have any parameter but parameter still has "1" in first position. I think it comes from previous call infact, doing some debug I found that at this line line the router is not reset and it recalls old parameters array. PHP Code: class CodeIgniter At the moment this workaroud does the trick PHP Code: public function testAbort() Thank you.
(06-19-2023, 01:18 AM)kenjis Wrote: Test https://github.com/codeigniter4/CodeIgniter4/pull/7597 if you can.Tested. It works! Thank you
The PR was merged. This bug will be fixed in the next v4.3.7.
|
Welcome Guest, Not a member yet? Register Sign In |