ILIAS
ILIAS copied to clipboard
Auth: Make `ilSessionTest` work
The tests in ilSessionTest
are always ignored and reported as "skipped" when executing our PHPUnit
test suite.
- With this PR I
mocked
the database by delegating calls to theilDBInterface
to an "in memory" database (PDO sqlite
). - Furthermore I removed a method which was/is not a test method at all:
tstBasicSessionBehaviour
There is an alternative to this PR: Completely delete the test file. Since the code unter test only contains wrapped database calls, it is IMO only possible to test the database calls.
The main reason why I did skip the old ilSession test was because it was flappy. The issue occured because of https://github.com/ILIAS-eLearning/ILIAS/blob/30e89b3bb44ea6bf4031d3d3563147fc5089ab2e/components/ILIAS/Authentication/classes/class.ilSession.php#L194C1-L199C1, which did run on arbitrary times. With the cron check around it, I would propose the following:
- [x] Keep the old test with methode renamed back to testBasicSessionBehaviour
- [x] Add a mock to that test that will return
true
when querying of the job auth_destroy_expired_sessions is active - [x] Add the current test as a second test
@pascalseeland Done
@pascalseeland This is ready to merge. I you don't have any objections, go go go!
Merged, with all checklist items completed!