When running integration tests we have to set up some WordPress Docker containers. This allows us to test against WordPress, which is the 'integration' part. An added bonus of this is that you also have a separate setup for writing patches and unit tests.
Clone the repository
Expose MySQL port
After cloning has been done, you have to expose the MySQL port, which allows us to connect to it later on.
wordpress-develop, open the
docker-compose.yml file and change:
This will expose the port to the local environment.
Edit your hosts file
Edit your hosts file by running
sudo nano /etc/hosts in your terminal and add the following:
Making your database accessible
To make your database accessible, run the following command:
Tying it all together
The last step is to tie it together with your
wordpress-seo cloned repository.
To do this, please ensure you've followed the steps regarding setting up PhpUnit.
Spin up the containers
If you've gone through all the above steps, it's time to start the containers!
In your terminal, run the following commands:
When you want to stop the containers, you simply can do:
npm run env:stop
If you get errors about the database connection, make sure other no MySQL processes are running in the background by running
brew services stop mysql in your terminal.