The unit-test repo is archived
https://github.com/joomla/test-unit
What is the suggested way for running unit tests in Joomla 4 context?
I just checkout from git, switch branch to 4.0-dev, composer install (and all the asset build) and then just run
./libraries/vendor/bin/phpunit
most will fail locally due to no test db connection but you can run individual tests eg:
./libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/VersionTest.php
That repo was from a poorly thought through workflow for this repo's automated tests, where all the tests lived in separate repositories from this one.
Check the Drone configuration file, or whatever the flavor of the month CI integration that goes against the rest of what the PHP ecosystem uses is; that should always have the correct commands to build a proper test environment and run the tests.
What is the suggested way for running unit tests in Joomla 4 context?
Please see also this Read.me.
https://github.com/joomla/joomla-cms/blob/4.0-dev/tests/Unit/README.md
@sakiss Please check the answers above, especially the one before this comment, and if it answers your question please close this issue here. Thanks in advance.
From my understanding, the _joomla/test-unit_ repo is no longer used and the tests can run solely by using the phpunit framework.
I will try to generate and run some unit tests, but if someone can confirm the above, is welcome.
Does this answer your question: https://github.com/joomla/joomla-cms/pull/23962
If you want to know more, maybe someone from this team (Do you even want to join?) will help you.
https://volunteers.joomla.org/teams/automated-tests-working-group
Thank you all for your feedback!
My conclusions regarding unit testing in Joomla 4 are:
testsuites node that points to the tests folder.$rootDirectory, to point to our Joomla root, the JPATH_CACHE, to point to our cache folder (site or admin) and also load the necessary namespaces, used for the extensions (administrator/cache/autoload_psr4.php).
Most helpful comment
Does this answer your question: https://github.com/joomla/joomla-cms/pull/23962
If you want to know more, maybe someone from this team (Do you even want to join?) will help you.
https://volunteers.joomla.org/teams/automated-tests-working-group