[TYPO3-v4] t3lib_utility_* only static?

Stefan Galinski sgalinski at df.eu
Wed Jul 20 19:36:17 CEST 2011


Steffen Gebert wrote:

> Hi,
> 
> should all the classes/methods in t3lib_utility_* be just static ones?
> 
> https://review.typo3.org/3437 wants to make t3lib_utility_HttpRequest a
> *real* class *g*
> IMHO it's a bit confusing and I'd try to put this into t3lib_
> 
> What's you opinion?
> 
> Kind regards
> Steffen
> 

Hi Steffen,

Please be aware that this step will be a real problem for any further unit 
tests and maybe also the existing ones. Unfortunately it's horrible to test 
code that relies on static method calls, because they cannot be mocked. Sure 
it's just a problem if the static methods are complex and rely on the 
database, global variables, other complex methods or the filesystem, but 
this is the case in most times. So I would prefer to have only non-static 
and non-finalized service classes in t3lib_utility like it's done for 
t3lib_utility_HttpRequest. 

http://misko.hevery.com/2008/12/15/static-methods-are-death-to-testability/

-- 
Stefan Galinski
staatl. geprüfter Informatiktechniker


More information about the TYPO3-project-v4 mailing list