Commit graph

3 commits

Author SHA1 Message Date
daniel
e239b02a5e Add convenience methods for asserting status.
This ensures that assertions work in a uniform way,
and provides meaningful messages in cause of failure.

Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
2022-03-16 22:44:25 +01:00
DannyS712
c3c54a90c7 Remove "@group Database" from non-integration tests
The point of Unit tests is that, among other things, there
is no database

And also some minor cleanup

Change-Id: I8f4a009fe36bf2a2fe79d3261b3b088d25747e20
2021-01-12 12:11:44 +00:00
RazeSoldier
f2c220adfc Fix installation failure due to unexpected dbpath under CLI installation
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
2019-07-23 00:39:18 +08:00