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)

AI Agent image

How to Build an AI Agent with Semantic Kernel (and More!)

Join Developer Advocate Luce Carter for a hands-on tutorial on building an AI-powered dinner recommendation agent. Discover how to integrate Microsoft Semantic Kernel, MongoDB Atlas, C#, and OpenAI for ingredient checks and smart restaurant suggestions.

Watch the video 📺

👋 Kindness is contagious

Dive into this insightful write-up, celebrated within the collaborative DEV Community. Developers at any stage are invited to contribute and elevate our shared skills.

A simple "thank you" can boost someone’s spirits—leave your kudos in the comments!

On DEV, exchanging ideas fuels progress and deepens our connections. If this post helped you, a brief note of thanks goes a long way.

Okay