Welcome Guest, Not a member yet? Register   Sign In
Session issue with CI Environment set to Testing (CI4)
#4

(10-27-2020, 06:59 AM)shanilsoni Wrote: So essentially, for 'testing' environment, it is setting session to null and hence session data was not available. Can somebody let me know why session is set to null in here? What is the reason behind this?

It is for unit testing with PHPUnit. In CI4, the environment `testing` is a special one for PHPUnit testing.

On unit testing, it is recommended every time all the status including global variables is the exactly same
before running a test. If not, the test result may differ.

If one test changes the session status, and the next test does not expect the status change, the next test would fail.
The failure is the real failure or not? Avoiding such a case, preparing to set the same status before executing a test
is recommended.
Reply


Messages In This Thread
RE: Session issue with CI Environment set to Testing (CI4) - by kenjis - 02-07-2021, 03:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB