You cannot check it ...
Unit testing sometimes causes such problems (unverifiable situations). This usually means that the problem is not in testing, but in the code and its architecture.
Here you should not use the die function (in fact you should not use die to return an HTTP response ), but echo json, and then let the script finish correctly (or return json and echo elsewhere).
To test this, you can capture the output and test it (this is a basic example, I think, much better).
Conclusion: there is a problem with your code, fix it, and then you can try testing it . If you cannot, then there is no testing.
Matthieu napoli
source share