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

Oliver Klee typo3-german-01 at oliverklee.de
Fri Dec 3 09:45:45 CET 2010


Hi,

Am 02.12.2010 18:48, schrieb Bastian Waidelich:
> AbstractDomainObject::getUid() is final to prevent people from
> overriding it in their entity class.
> Why do you need to mock this setter?

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

> You can create an "accessible" mock that allows you to get and set all
> protected members:

Yes, that's what I'm currently using. :-)

The use case is a test for Repository::update where I need to pass a
domain model that has a UID.

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).

What do you think?


Oli
-- 
Certified TYPO3 Integrator | TYPO3 Security Team Member


More information about the TYPO3-project-typo3v4mvc mailing list