This ensures that assertions work in a uniform way,
and provides meaningful messages in cause of failure.
Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
The point of Unit tests is that, among other things, there
is no database
And also some minor cleanup
Change-Id: I8f4a009fe36bf2a2fe79d3261b3b088d25747e20
1. Make sure `wgSQLiteDataDir` is not empty.
2. Fix a logic bug
In the current logic, in web environment, SqliteInstaller::dataDirOKmaybeCreate()
will be executed twice, first in the DBConnect page [1] (with $create=true),
and the second time in Installer::performInstallation() [2] (with $create=false),
this is a sanity check.
But in cli environment, SqliteInstaller::dataDirOKmaybeCreate() will
be only executed once, called by Installer::performInstallation() (with $create=false).
So the Cli installer will abort because the data directory is checked
without the behavior of creating the directory.
In this case, I split dataDirOKmaybeCreate() into checkDataDir() and
createDataDir() according to its responsibility. And for web installation,
we just check the directory on DBConnect page instead of creating it and
then actually creating it in setupDatabase().
3. Add a unit test for SqliteInstaller::dataDirOKmaybeCreate
[1] DBConnect page call SqliteInstaller::submitConnectForm(),
::submitConnectForm() call ::dataDirOKmaybeCreate()
[2] Installer::performInstallation() call SqliteInstaller::setupDatabase(),
::setupDatabase() call ::dataDirOKmaybeCreate()
Bug: T217855
Change-Id: I139036b265716e9898fb76ba907c194f005ea318