DEV Community

Ariel Mejia
Ariel Mejia

Posted on

Fix Memory Exhausted Issue in Laravel Tests

Quick and easy tip, sometimes a test could take too much time/memory, you can set your local environment memory_limit, but take in mind that you should repeat this process on every environment (local, staging, production) and all development team environments should add this configuration, not best solution right?

Fortunately. PHPUnit provides a simple solution for this cases you can set a memory_limit value that would instruct the memory limit only when the app runs tests.

In your phpunit.xml file add this configuration:

<php>
 ...
 <ini name="memory_limit" value="512M"/>
</php>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)