The package has a local PHPUnit configuration:
vendor/bin/phpunit -c package/session/phpunit.xml.distOn Windows:
vendor\bin\phpunit.bat -c package\session\phpunit.xml.disttests/bootstrap.phploads either the package vendor autoloader or the workspace root autoloader.tests/Fixturescontains small test drivers.tests/Unitcontains object-level tests for contracts, bags, manager behavior, native driver behavior, and exceptions.
The suite covers:
SessionManagerlifecycle delegation;- driver switching and invalid driver errors;
- root values and named bags;
- flash message read-once behavior;
- corrupt namespace detection;
- native session start, data, regenerate, save, invalidate, and warning conversion;
- contract implementation;
- session status mapping;
- exception factory messages and previous exceptions.
Native session tests run in separate PHP processes because PHP session state is global. They use a temporary session save path under .phpunit.cache/sessions.
When adding native tests:
- avoid writing output before
session_start(); - keep cookie usage disabled unless a test specifically needs it;
- cleanly close, abort, or destroy active sessions;
- prefer separate processes for tests that mutate session globals.
Custom drivers should have their own package tests. At minimum, driver tests should prove:
start()activates the session;data()returns the active payload by reference;save()persists or closes as expected;invalidate()clears storage;regenerateId()returns the new ID;- storage failures throw session exceptions.