Why PHPUnit tests run faster when the machine is disconnected from the internet?
Wow that wasn't expected. Turns out my tests are slow because of the image()
function provided by the PHP Faker package $faker->image()
.
I was using it in one of my factories to prepare a fake Image for the DB, I didn't know it's literally downloading images and storing them in folder like this /private/var/folders/51/5ybn3kjn8f332jfrsx7nmam00000gn/T/
.
I was able to find that by monitoring what the PHP process is doing while the test is running, to find out it has an open .jpg file in that directory, so I looked in my code anything related to images and discovered that, after about 6 hours of debugging. Happy coding :)