Setting up a WordPress install for “theme unit tests”

Documentation for Theme Unit Tests is at http://codex.wordpress.org/Theme_Unit_Test

Did it all through the Mac terminal…

Pre-requisites: Homebrew, homebrew’s mysql package ( brew install mysql ), and homebrew’s php55 package. Ask if you have trouble installing them.

Installing wp-cli

Documentation for wp-cli is at http://wp-cli.org/

curl -kL https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info

Creating a WordPress install

mkdir wp-trt
cd wp-trt/
wp core download
wp core config --dbname=wp-trt --dbuser=root
wp db create
wp core install --url=http://localhost:6789 --title=WPTRT --admin_user=danny --admin_password=blastworth --admin_email=dan@bernardic.ca
nohup php -S localhost:6789 &
* I was getting an error recently with a fresh install of mysql from homebrew, saying a database connection can not be established, during the `wp core install` step. After creating the symlinks as shown here, it worked.

Installing theme unit tests

curl -O https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml
wp plugin install wordpress-importer --activate
wp import ./theme-unit-test-data.xml --authors=create
rm theme-unit-test-data.xml

Published by

Dan Bernardic

A Winnipeg Web programmer. Proud member of the Skip the Dishes team. Experienced with Web technologies, e.g. HTML5, CSS, ( Server-side ) JS, PHP, WordPress, MVC, etc.

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s