[TYPO3-dev] Unit tests
Bernhard Kraft
kraft at webconsulting.at
Mon Dec 16 17:12:21 CET 2013
Hello,
When writing unit tests for the core or extensions I came across the
following problem: How should I handle obvious errors/problems with
current source.
When a method is returning some result which does not conform to the
methods description and/or intention. How should this get handled in a
unit test? Is it possible to mark this as some kind of "todo".
I mean it IS no error as it is currently in the source and working. But
for some special input it will generate an error or at least not behave
correctly. So the unit test should recognize this and generate some kind
of warning or "todo" message.
Whenever the method gets refactored such issues should get handled.
An example: The method "extractHyperLinks" of direct_mail:
When passing a link like:
--------------------------
<a title=http://google.com href="http://google.com" />
--------------------------
to the method it will return an array with
quotes => ''
Altough the "href" attribute obviously has quotes around it so
quotes => '"'
should get returned.
This is related to the internal coding of "extractHyperLinks".
So how should this get handled in an unit test?
Of course a bug report should get created for every such issue but the
unit test should still run through.
greetings,
Bernhard
More information about the TYPO3-dev
mailing list