[TYPO3-core] RFC #0016552: Add unit tests for t3lib_div::makeInstance

Martin Kutschker masi-no at spam-typo3.org
Wed Nov 24 20:57:36 CET 2010


Am 24.11.2010 14:56, schrieb Oliver Klee:
> Hi,
> 
> this is an SVN patch request.
> 
> Type: new unit tests
> 
> BT Reference: http://bugs.typo3.org/view.php?id=16552
> 
> Branches: trunk
> 
> Problem and solution:
> t3lib_div::makeInstance function should have some tests. Let's provide them.

makeInstancePassesParametersToConstructor() - the name implies multiple parameters but actually only
for one is tested. There is no test that covers the case when more than one parameter is used.

makeInstanceCanReturnInstanceOfNonSingletonClass() and
makeInstanceCanReturnInstanceOfSingletonClass() are identical except for the class, so the latter
repeats only the former. I think it can be dropped. See also my first argument for another reason.

nitpicks:

makeInstanceCanReturnInstanceOfNonSingletonClass() isn't about singletons. Why not simply call it
makeInstanceCanReturnInstanceOfClass()

makeInstancePassesParametersToConstructor() uses a funny but insignificant test value. I have been
advised to use a "speaking" value, eg the string "constructor parameter".

Masi


More information about the TYPO3-team-core mailing list