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?
Labels |
Added:
?
?
|
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
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: #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:
We no longer need the joomla/test-unit repo for our tests.
If we are running tests for the Joomla framework, the https://github.com/joomla/joomla-cms/tree/staging/tests , is enough.
If we want to have tests in the component level, we need:
a. The phpunit/phpunit repo, in our system.
b. Our own php-unit.xml, with a bootstrap attribute that points to a new bootstrap file and a testsuites
node that points to the tests folder.
c. Our bootsrap file can be a copy of https://github.com/joomla/joomla-cms/blob/4.0-dev/tests/Unit/bootstrap.php , but we have to change the $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).
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-07-16 10:32:16 |
Closed_By | ⇒ | sakiss |
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