![]() |
Feature test http responses interfere between tests - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Feature test http responses interfere between tests (/showthread.php?tid=80052) |
Feature test http responses interfere between tests - Taras - 09-07-2021 Hello I am writing feature tests that access post and get endpoints. PHP Code: public function testAbc() Second assertion fails also controller does not have redirect. When I am dupming response value into console it looks sometimes fine or may contain previous response it some cases. It looks like response has data from the previous test for some reason. Why this happens? How it should be cleared? Test class is defined like this: PHP Code: class MyFeatureTestCase extends CIUnitTestCase RE: Feature test http responses interfere between tests - Taras - 09-09-2021 It turned out that issue was caused by redirect in controller in post action: PHP Code: return $this->response->redirect(route_to('abc.view', $id)); PHP Code: return redirect()->to(route_to('abc.view', $id)); Can anybody please explain what is the difference between them and why first one fails? Is it wrong to use it? In browser all works fine. |