Setting up wordpress test environment

Step 1 : Getting your virtual environment up and running.

cd ~/Public
mkdir faisal
cd faisal
git clone .
vagrant up
vagrant ssh

Step 2: Install SVN to get test wordpress codebase from wordpress.

sudo apt-get update
sudo apt-get install subversion

Step 3: Install phpUnit to run your unit tests

curl -O
sudo chmod +x phpunit-4.8.phar
sudo mv phpunit-4.8.phar /usr/local/bin/phpunit
phpunit --version

Step 4: Install WP-CLI to setup the test environment

curl -O
sudo chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp-cli
wp-cli --version

Step 5: Setting up the test plugin folder

curl -O
tar xvzf latest.tar.gz .
cd wp-content/plugins/
mkdir demo
cd demo
touch demo.php
wp scaffold plugin-tests demo

Step 6: Setting up the test environment

cd ~/Public/faisal
bash bin/ wordpress_test root root localhost latest

Step 6: Check if test is running or not.

cd ~/Public/faisal/wp-content/plugins/demo/

You should now see something similar to this –


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s