PHPunit takes a long time to start on Homestead, which results in slow testing

I have created a basic Lumen
application and I try to run few tests using PHPUnit.

When I run a simple call to phpunit in my local terminal it takes about 120ms for the tests to be completed. However, when I run the same call in homestead machine
(vagrant) it takes more than 3seconds(!) to complete! That’s insane.

I’ve done some testing and it seems that the tests them self aren’t slow it just that phpunit is super slow to boot on homestead. I guess it might be slow for homestead to execute the phpunit executable? The same is true for composer which is much slower ran on homestead than on my local terminal, but it is not as slow as phpunit in terms of percentages.

Any idea how I can fix this “delay” and make phpunit tests run fast on homestead as-well?

is due the filesystem used to mount Windows’ Folders on homestead.

Homestead is managed by Vagrant that uses VirtualBox to launch Virtual Machines, and Virtual Box use vboxsf as a file system, I don’t know why but this is too slow to run PHPUnit.

I guess you have your code on the windows’ folders and reach it from homestead using the standard shared folder provided by Vagrant/VirtualBox.(That is my case)

I mounted a Windows Shared Folder (my code is there) using CIFS as a file system and reduced the execution time of my tests from 58.46s to 6.51s.

Here you find the indications to this: https://wiki.ubuntu.com/MountWindowsSharesPermanently

Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » PHPunit takes a long time to start on Homestead, which results in slow testing

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录