[TYPO3-core] RFC #17342: t3lib_formprotection_BackendFormProtectionTest causes php fatal error
Nikolas Hagelstein
lists at shr.cc
Wed Jan 26 17:26:17 CET 2011
This is an SVN patch request.
Type: [Bugfix]
Bugtracker references:
http://bugs.typo3.org/view.php?id=17342
Branches:
"TYPO3_4_trunk".
Problem:
The t3lib_formprotection_BackendFormProtectionTest test sets
$GLOBALS['BE_USER'] to a mocked BE user object.
Revision 10306 introduced
t3lib_formprotection_BackendFormProtection::isAuthorizedBackendSession()
The methode isAuthorizedBackendSession() is called on construction of
t3lib_formprotection_BackendFormProtection and an exception is thrown if
it fails.
Within the test an instance of
t3lib_formprotection_BackendFormProtection is created. This fails due to
the above mentioned BE user mocking and the checks in
isAuthorizedBackendSession() (see source).
Furthermore a php fatal error occurs since __destruct() is call within
tearDown of the test. Which isn't possible since the object has never
been created (due to exception in constructor).
Solution:
Copy actual user property to the mocked object. Remove call to desctruct();
Notes:
This is just a quickfix. It would be better to stop messing arround with
GLOBALS within tests and the actuall class implementation.
Something like: isAuthorizedBackendSession($beSession) and injection of
the current beSession on construction would be much cleaner and easier
to test imho. But that is another story.
Cheers,
Nikolas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 17342.patch
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20110126/8cb4f242/attachment.asc>
More information about the TYPO3-team-core
mailing list