Such as the title codeception unit test Undefined index: HTTP_HOST error reporting
Test driven code:
commonconfigmain.php cross-domain login code:
When the test driver runs to commonconfigmain.php, an Undefined index: HTTP_HOST error is reported. Please tell me how to solve it.
Such as the title codeception unit test Undefined index: HTTP_HOST error reporting
Test driven code:
commonconfigmain.php cross-domain login code:
When the test driver runs to commonconfigmain.php, an Undefined index: HTTP_HOST error is reported. Please tell me how to solve it.
Define the following variables in the bootstrap file, such as
$_SERVER['HTTP_HOST'] = 'foo.com';
Because of the codeception unit, PHP runs in cli mode, and some variables starting with HTTP under $_SERVER are not defined. So you have to manually define and simulate some data on the web, so that no error will be reported when running there.
I suggest you use acceptance tests, or you encapsulate your code into functional classes and then use functional tests. It makes no sense to write the code directly into the test driver