Feature #81

Improve component manager separation in Base Test Case

Added by Robert Lemke over 12 years ago. Updated about 9 years ago.

Must have
Target version:
Start date:
Due date:
% Done:



Currently all tests get a complete copy (including subobjects) of the component manager injected. This happens in source:Packages/Testing/Classes/T3_Testing_BaseTestCase.php#398 . However, the serialize / unserialize method will surely cause problems as soon as we have persistence in place, so we need a finer grained solution here.

The problem is that some unit tests do change component configuration or even package configuration. This needs to be isolated from other tests.

Associated revisions

Revision 50ee70ae (diff)
Added by Robert Lemke about 12 years ago

  • FLOW3: Added new folders and files to the global /Configuration directory
  • FLOW3: Added new sections to the documentation (FLOW3 Bootstrap and Cache).
  • FLOW3: Implemented a finer grained, improved bootstrap within the FLOW3 class. The boot sequence now consists of different initialization levels which assert that initialization on higher levels can only be done if lower levels have been initialized and once initialized, a level can't be initialized again.
  • FLOW3: Added new (yet quite empty) sections to the manual.
  • FLOW3: (Package) Moved the component configuration functions to the FLOW3 class.
  • FLOW3: (Error) The exception handler now shows the beginning and the ending of an argument value (instead of only the beginning) if it is longer than 40 characters.
  • FLOW3: (AOP) Had to remove the getAspectContainers() method again because it conflicted with caching. If we really need this function, it can be reimplemented, but it will only work if proxy caching is disabled.
  • FLOW3: (Utility) Made sure that paths returned by getPathToTemporaryDirectory() end with a slash as defined in DIRECTORY_SEPARATOR
  • TYPO3CR: Made the StorageAccess_PDOTest use a temporary directory instead of the private file cache
  • Testing: Improved the cloning of the component manager by switching from unserialize(serialize()) to "clone". Addresses #81 (but maybe doesn't complete solve it).


#1 Updated by Karsten Dambekalns over 12 years ago

Err, why does it unserialize(serialize(...))?

#2 Updated by Robert Lemke over 12 years ago

Because unserialize(serialize()) will create a copy of the object recursively while clone would only copy the component manager and not its related objects.

#3 Updated by Karsten Dambekalns over 12 years ago

Ok, guessed that already a minute ago and verified it's needed to make everything work as expected.

One problem I already had with the used method is that it (sometimes) runs out of memory (currently using memory_limit of 128MB here).

#4 Updated by Malte Jansen over 12 years ago

Perhaps some variables could be unset in some classes, which are not needed anymore after there usage (especially if the classObject is stored tempoarly).

Until now this solved the problem for the TYPO3CGL, which works in simluar ways to the Testing-Package with PHPUnit. The TYPO3CGL still works with less than 32MB of memory. Before unsetting some variables it was more than 64MB.

#5 Updated by Karsten Dambekalns almost 12 years ago

  • Target version deleted (1)

#6 Updated by Karsten Dambekalns over 11 years ago

This one will be solved by simply not providing any part of FLOW3 to the BaseTestCase and making sure all tests use mocked versions of the needed components. I started refactoring tests towards that goal late last year and we'll continue to do so, at least for FLOW3, TYPO3CR and other core parts.

To make sure your tests run in the future, make sure to never use the provided $this->objectManager in your testcases.

#7 Updated by Karsten Dambekalns over 11 years ago

  • Status changed from New to Accepted
  • Assignee deleted (Karsten Dambekalns)
  • Priority changed from Should have to Must have

#8 Updated by Karsten Dambekalns over 9 years ago

  • Status changed from Accepted to Resolved
  • Assignee set to Karsten Dambekalns
  • Target version set to 1.0 alpha 14

No more $this->objectManager for unit tests has been reality for quite a while now...

#9 Updated by Karsten Dambekalns over 9 years ago

  • % Done changed from 0 to 100

#10 Updated by Karsten Dambekalns about 9 years ago

  • Target version deleted (1.0 alpha 14)

Also available in: Atom PDF