Feature #81

Improve component manager separation in Base Test Case

Added by Robert Lemke almost 14 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Must have
Target version:
-
Start date:
Due date:
% Done:

100%

Estimated time:

Description

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.

#1

Updated by Karsten Dambekalns almost 14 years ago

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

#2

Updated by Robert Lemke almost 14 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 almost 14 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 almost 14 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 over 13 years ago

  • Target version deleted (1)
#6

Updated by Karsten Dambekalns almost 13 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 almost 13 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 almost 11 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 almost 11 years ago

  • % Done changed from 0 to 100
#10

Updated by Karsten Dambekalns over 10 years ago

  • Target version deleted (1.0 alpha 14)

Also available in: Atom PDF