Testing with Sessions

Symfony is designed from the ground up with code-testability in mind. In order
to make your code which utilizes session easily testable we provide two separate
mock storage mechanisms for both unit testing and functional testing.

Testing code using real sessions is tricky because PHP's workflow state is global
and it is not possible to have multiple concurrent sessions in the same PHP
process.

The mock storage engines simulate the PHP session workflow without actually
starting one allowing you to test your code without complications. You may also
run multiple instances in the same PHP process.

The mock storage drivers do not read or write the system globals
session_id() or session_name(). Methods are provided to simulate this if
required: