diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2023-12-27 13:08:41 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2023-12-27 13:08:41 +0100 |
commit | 7cb8ecd36b128d07b5086904af48601b9096cdea (patch) | |
tree | 00e9449cd2a2cf0c2bb91ee3baf013e1ff7c35f8 /Zotlabs/Lib/Config.php | |
parent | 2aa64ebdd0c794d35d66b251c5ef4272d8ab5749 (diff) | |
download | volse-hubzilla-7cb8ecd36b128d07b5086904af48601b9096cdea.tar.gz volse-hubzilla-7cb8ecd36b128d07b5086904af48601b9096cdea.tar.bz2 volse-hubzilla-7cb8ecd36b128d07b5086904af48601b9096cdea.zip |
tests: Enable and fix incomplete tests.
Since the tests now have access to the database, there's no longer any
need for mocking or stubbing functions that uses the db. As the codebase
relies on global state and static class functions (aka classes as
namespace), stubbing these are not straight forward and complicates the
test code, and reliability.
With access to the database, we can now perform these tests by
populating the db tables with the content relevant for the test, and
perform the actual tests to verify that the code behaves as expected
given the db content we've created.
In the tests I enabled in this patch, I've explicitly set the expected
configuration in the db using the available API's in the code itself.
While it would also be possible to add more permanent fixtures to set
the db in the expected state, doing it dynamically like this has some
advantages.
It allows very specific setups for the test that we may not want to be
set of every test. The photo factory test to ignore Image Magick is a
good example of that. We may want to also test the opposite, that Image
Magick is selected if the flag is not set (and the extention is
available.)
Also, the fixtures themselves are not more informative than the table
column names they contain, so comments would be needed to document both
the content and how it fits into the test environment. With the more
dynamic approach the test code becomes more self documenting.
Diffstat (limited to 'Zotlabs/Lib/Config.php')
0 files changed, 0 insertions, 0 deletions