![]() |
Problem with Autorouting improved and HTTP Testing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Problem with Autorouting improved and HTTP Testing (/showthread.php?tid=87818) |
Problem with Autorouting improved and HTTP Testing - massimiliano1.mancini - 06-04-2023 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 RE: Problem with Autorouting improved and HTTP Testing - kenjis - 06-05-2023 It seems there is a bug that caches HTTP verb when HTTP testing. RE: Problem with Autorouting improved and HTTP Testing - kenjis - 06-05-2023 Check https://github.com/codeigniter4/CodeIgniter4/pull/7543 if you can. RE: Problem with Autorouting improved and HTTP Testing - massimiliano1.mancini - 06-05-2023 I have subscribed the github issue. Thank you Kenjis RE: Problem with Autorouting improved and HTTP Testing - massimiliano1.mancini - 06-19-2023 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. RE: Problem with Autorouting improved and HTTP Testing - kenjis - 06-19-2023 Test https://github.com/codeigniter4/CodeIgniter4/pull/7597 if you can. RE: Problem with Autorouting improved and HTTP Testing - massimiliano1.mancini - 06-19-2023 (06-19-2023, 01:18 AM)kenjis Wrote: Test https://github.com/codeigniter4/CodeIgniter4/pull/7597 if you can.Tested. It works! Thank you RE: Problem with Autorouting improved and HTTP Testing - kenjis - 06-29-2023 The PR was merged. This bug will be fixed in the next v4.3.7. |