User tests: Successful: Unsuccessful:
With all of the class namespacing going on, we don't really have a procedure in place for adding unit tests for new namespaced classes. Luckily this isn't a problem within 3.x right now, but in 4.0 we have added a bunch of classes and right now they have zero test coverage.
With the introduction of Codeception for other test types, we can look at ways to make use of it for addressing this issue. And since Codeception can run PHPUnit tests, there should be no tooling conflicts.
My first draft of this moves the test class for the former JErrorPage
, now Joomla\CMS\Exception\ExceptionHandler
, into the Codeception unit test space. The convention I've used thus far is to use a root cms
directory which would basically be the equivalent of 3.8's libraries/src/Joomla/CMS
directory then the tests would follow the same structure we have now (the file/folder mapping closely matches up to the production system).
I've added arbitrary autoloader support as well using the Joomla\CMS\Tests
namespace. So in places where we're requiring stub classes, they now have an autoloader mapping.
Status | New | ⇒ | Pending |
Category | ⇒ | Unit Tests External Library |
It should. The only possible incompatibility right now is I put the dev autoload statement in the root Composer manifest versus the Codeception Composer manifest (I'm not quite sure why we need that one but let's roll with it for now). In theory both libraries/vendor/bin/phpunit --testsuite libraries
and tests/codeception/vendor/bin/codecept run unit
should run the same tests with this, but since I haven't set up the unit test bootstrap in Codeception the latter command won't work right now.
Category | Unit Tests External Library | ⇒ | Repository Unit Tests External Library Libraries |
This is at a point now where running both libraries/vendor/bin/phpunit --testsuite libraries
and tests/codeception/vendor/bin/codecept run unit
can work for running the tests for this class. The Codeception unit test suite's bootstrap is just mimicking the PHPUnit suite's bootstrap for now to get everything imported, we can work out shuffling some of the helper resources around later.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-31 22:24:58 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
Removed: ? |
Category | Unit Tests External Library Repository Libraries | ⇒ | Repository Unit Tests External Library Composer Change Libraries |
Can you have a look here #16743 if this works together?