So you want to add unit tests to your plugin or theme and you have a local install setup. You’ve followed the instructions for installing your tests from somewhere like https://pippinsplugins.com/unit-tests-wordpress-plugins-setting-up-testing-suite/ and written your first test.
It’s all good.
The only downside to this is that every time you bootstrap your tests then the latest version of the WordPress tests package is downloaded. Now this is great if you have an internet connection.
But what do you do if you don’t?
When tests are boostrapped then the location of the WordPress tests package as defined in the bootstrap.php file, found in the tests folder of your plugin, is checked and if it is not there, the package is downloaded. So to run your tests when you are offline you have to do 2 things.
1. Copy the WordPress test package to a non-temporary location on your local machine,
2. Edit the $_tests_dir variable in the bootstrap.php file to point to your copy of the WordPress tests package.
Hey presto you can now test when you have no internet connection.
Bear in mind you will need to update your copy of the tests package on a regular basis to make sure the test package is current.