[TYPO3-core] FYI72: Bug #15382: [Unit tests]: Streamline and refactor t3lib_divTest

Christian Kuhn lolli at schwarzbu.ch
Sat Aug 7 01:14:14 CEST 2010


The attached patch will be committed in 72 hours if nobody objects.

Type: Unit test cleanup

BT: http://bugs.typo3.org/view.php?id=15382

Branches: trunk, 4.4

Problem:
While there are still a lot of missing unit tests for t3lib_div, it's 
already one the best tested classes in the core. This class could be an 
example for a "how to write sane tests" documentation, if we modernize 
and streamline some of the existing tests.

Solution:
Clean up current tests:
- Every test method name starts with the tested method name, do not 
start with "check", "does", etc.
- Improve naming of some methods
- Refactor some tests to use data providers
- Add missing comment blocks "test concerning xy" to improve overview
- Remove superfluous comments and annotations which are already clear by 
the test method name
- Minor CGL improvements
- Reduce number of tests with multiple assertions, usual goal is to have 
only one assertion per test
- Use "named" data providers, which show a meaningful message
- Remove some duplicate tests

How to test:
You should get green bar feeling before and after applying the patch.

Notes:
Please do not add / change t3lib_div tests in 4.4 / trunk until this 
issue is committed to prevent this patch from breaking ... it was a 
pretty stupid task anyway and I don't want to repeat it ;)

Regards
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 15382_01.diff
Type: text/x-patch
Size: 44685 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100807/7f19fc03/attachment-0001.bin>


More information about the TYPO3-team-core mailing list