[TYPO3-mvc] Testing entity equality with PHPUNIT

Henrik Møller Rasmussen info at hmrdesign.dk
Tue Mar 13 11:00:07 CET 2012


Hi,

I've just started using the PHPUNIT extension to test some Extbase 
models and I have a question regarding entity equality testing.

Lets say I have a service that takes in two entities of the same type 
and returns something based on their equality.

Normally I would in the service use:
$entity1->getUid() === $entity2->getUid()

to test the equality.

How would you go about mocking the two entities to be different? I have 
mocked all the connections to the repositories, so the entities have no uid.

Best regards

Henrik Rasmussen


More information about the TYPO3-project-typo3v4mvc mailing list