? ? ? ? Pending

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
19 Jun 2017

Summary of Changes

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.

avatar mbabker mbabker - open - 19 Jun 2017
avatar mbabker mbabker - change - 19 Jun 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jun 2017
Category Unit Tests External Library
avatar rdeutz
rdeutz - comment - 19 Jun 2017

Can you have a look here #16743 if this works together?

avatar mbabker
mbabker - comment - 19 Jun 2017

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.

avatar joomla-cms-bot joomla-cms-bot - change - 1 Jul 2017
Category Unit Tests External Library Repository Unit Tests External Library Libraries
avatar mbabker
mbabker - comment - 1 Jul 2017

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.

avatar mbabker mbabker - change - 31 Mar 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-03-31 22:24:58
Closed_By mbabker
Labels Added: ?
Removed: ?
avatar mbabker mbabker - close - 31 Mar 2018
avatar joomla-cms-bot joomla-cms-bot - change - 31 Mar 2018
Category Unit Tests External Library Repository Libraries Repository Unit Tests External Library Composer Change Libraries

Add a Comment

Login with GitHub to post a comment