@peterhashair opened this Pull Request on October 14th 2021 Contributor


Fixes: #17856
update database test work without section set. use getenv('TEST_SUITE') to diff the travis and local.


@peterhashair commented on October 18th 2021 Contributor

@sgiehl Sorry for the confusion. The purpose of this change is to run Matomo PHP tests locally without setup [database_tests] section in the config.ini.php. So it should copy the username , password , host from [database] then make a matomo_tests database.

I think those three lines init an empty test environment, the forceSave won't append default database connection to [database_tests] in the config.ini.php file, the local PHP tests doing database access deny . But if I removed it, Travis start to fail, so I add getenv to different 2 environments.

Remove this line. Because after the test runs locally, the code alters the [database] section. A forceSave() has been called.
Add this host = "", purpose to pass Plugins\CoreAdminHome\tests\Integration\Commands\ConfigGetTesttests/PHPUnit/proxy/index.phpassert database access deny. Because I empty the[database_tests]localhost inglobal.ini.phpto auto pass from[database]`.

@sgiehl commented on October 19th 2021 Member

@peterhashair The problem with not using the TestingEnvironmentManipulator locally at all will cause tests to overwrite your local config. Similar to the database section update (you removed it), now any test can manipulate it. Try e.g. running the test MultipleSitesArchivingTest. This will then change your config file:

@peterhashair commented on October 19th 2021 Contributor

@sgiehl that actually make sense, update it a little bit. so init again after the config database_tests is set.

@peterhashair commented on October 27th 2021 Contributor

@sgiehl that one good to go?

This Pull Request was closed on October 28th 2021
Powered by GitHub Issue Mirror