Faster PHPUnit tests

Fredrick Mgbeoma
Aug 8, 2017 · 1 min read

While creating unit tests for an app I was building, I delved a bit into testing a bit beyond the app. The two screenshots below show the speed differences while running phpunit.

Screenshot 1 — fast
Screenshot 2 — slow

The first screenshot (screenshot1) shows the result of running phpunit using the locally installed phpunit in the application. This resulted in faster unit test, 30ms to be exact and 4.00 MB.

The second screenshot(screenshot2) shows the output of running the exact tests but in this case using the phpunit installed globally. This took about twice the time the locally installed phpunit executed.

The above differences would not be easily noticed while running a series of small unit tests, but the performance differences would become more noticeable while running a significant number of tests.

Fredrick Mgbeoma

Written by

A daring programmer with a passion for making dreams come true.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade