[TYPO3-mvc] RFC #11225: Tx_Extbase_DomainObject_AbstractDomainObject::getUid cannot be mocked as it is final

Bastian Waidelich bastian.waidelich at typo3.org
Fri Dec 3 12:44:38 CET 2010


Oliver Klee wrote:

Hi Oliver,

>> Why do you need to mock this setter?

> Actually, I want to mock the getter, not the setter.

Sure, that was a typo ;)


> I'd find it cleaner to just mock some methods (which are public API) in
> my tests instead of directly manipulating some fields (which could be
> moved/renamed/refactored).

AbstractDomainObject::getUid() is not part of the public API, see [1].
But anyways, public API does not mean, that a method can't be final.
As mentioned getUid() is final to prevent people from overriding it in 
their entity class which could have unpredictable side effects..

I think, using the accessible mock is a good alternative.
If you agree, I'd like to close the issu.

Best,
Bastian

[1] http://forge.typo3.org/projects/typo3v4-mvc/wiki/Public_API


More information about the TYPO3-project-typo3v4mvc mailing list