Skip to content
  • Christian Kuhn's avatar
    [TASK] Reduce memory footprint of unit tests · 2d05837d
    Christian Kuhn authored
    Running the whole unit test suite on cli can eat up a significant
    amount of memory. Most of that can not be mitigated due to phpunit
    itself, but we can at least hint the PHP garbage collection by
    unsetting test class properties in tearDown().
    
    The patch introduces a generic tearDown() method that reflects the
    test class and unsets all temporary properties of the class. In
    effect, tests do not need to take care of unsetting properties.
    
    The patch removes all tearDown() methods that only unset() stuff
    and keeps others that do additional things but adds a call to
    parent::tearDown(). Private properties are changed to protected,
    so parent::tearDown can reach them. The additional computing
    effort of the reflection is insignificant, the suite is nearly as
    fast as before.
    
    Results:
    php 5.3: 1056MB -> 851MB
    php 5.4: 870MB -> 670MB
    php 5.5.: 876MB -> 674MB
    
    Resolves: #55850
    Related: #51436
    Releases: 6.2
    Change-Id: Ie665c53a3ab35e4808677e483d2099e0511c393f
    Reviewed-on: https://review.typo3.org/27528
    Reviewed-by: Helmut Hummel
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn
    2d05837d