php - Using PHPUnit to test cookies and sessions, how? -


It is easy to test the raw PHP code with PHPUnit, but what about the code that relies heavily on cookies? Session can be a good example.

Is there any way that I do not need to set up $ _ cookie with data during my trial? This is a way to do things.

This is a common problem with code, especially PHP code. The general technique to be used in the related objects is to pull the COKI / session variable forward and use the control technology (exposure) to draw those dependencies into the scope.

I think, before executing the test, only overriding super global value can be achieved with the same legacy code.

Cheers, Alex


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -