Answer the question
In order to leave comments, you need to log in
Codeception and Yii2: how to get the user's ip in a functional test?
I want to test user authentication in REST API. Access to api is allowed only from certain ip addresses. The $request->getUserIP() method is called in the code, after which it checks whether the given ip is among the allowed ones.
But in functional tests I have $_SERVER['REMOTE_ADDR'] empty. Accordingly, the test never passes the test.
Has anyone encountered such a situation? Or maybe you need to use acceptance tests? But I would like to somehow check this functionality through a functional test.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question