[TYPO3-dev] Problems with phpunit feature backupGlobals

Helmut Hummel helmut at typo3.org
Sun Aug 22 23:23:13 CEST 2010


On 22.08.10 08:17, Helmut Hummel wrote:
> Hi,
> 
> during writing the unit tests for t3lib_preparedStatement class, I
> encontered a problem with the backupGlobals feature of phpunit.
> 
> This feature comes in heandy since, when acitveated, it takes care of
> backing up and restoring all global and superglobal variables.
> 
> Unfortunately it does so by serializing each variable. Because
> serializing does not support resource types[1], the $GLOBALS['TYPO3_DB']
> object is missing the $GLOBALS['TYPO3_DB']->link.
> 
> Unfortunately quite some tests in TYPO3 core are setting this class
> variable to true, affecting all following test, which needs database access.
> 
> Does anybody have an idea how to solve this problem? Since I do not
> understand, why phpunit serializes the variables, I would go fix/ patch
> it to make it worl for us.

OK, Sebastian Bergmann gave me a hint. We must add TYPO3_DB to the
blacklist and handle the backup and restore of it in setUp() and
tearDown() if it is mocked during the testcase.

Regards Helmut




More information about the TYPO3-dev mailing list