Project

General

Profile

Actions

Bug #24838

closed

[Unit Tests] t3lib_formprotection_BackendFormProtectionTest causes php fatal error

Added by Nikolas Hagelstein almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
Start date:
2011-01-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

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

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.
(issue imported from #M17342)


Files

17342.patch (749 Bytes) 17342.patch Administrator Admin, 2011-01-26 17:16
Actions

Also available in: Atom PDF