doqw89029 2010-11-18 14:51
浏览 68
已采纳

PhpUnit与Zend Framework内存问题

I've just started using PHP Unit with Zend Framework and I have a problem with the memory_limit. Currently, the memory limit is set to 32M and when running all tests I get an fatal error:

Allowed memory size of 33554432 bytes exhausted.

Currently, I have: 7 files, 125 tests, 332 assertions. I only test the controllers. I use @dataProvider for some tests, with the 1 to 5 sets of data (at first I was reading them from file, I've tried to put the data directly in the tests files, but it still hits the memory limit)

So my question is what is your usual memory limit for phpunit based testing? Where should I look to improve the memory testing? Any advice will be great.

Thanks, Gabriel

  • 写回答

5条回答 默认 最新

  • dongyi9330 2010-11-18 15:31
    关注

    I've run into a similar issue after my test suite exceeded 300 cases with 128M memory limit.
    What helped me was running test cases in isolated processes. You can do this either from command line:

    phpunit --process-isolation
    

    or add it to your phpunit.xml config:

    <phpunit bootstrap="./application/bootstrap.php"
        processIsolation="true">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line