WPBrowser and Travis CI 04

Outsourcing WordPress installation in Travis CI and WPBrowser testing.

Same code every time

As announce in the previous post I’ve spent some time tinkering with wp-browser own Travis CI configuration file to move the boilerplate set up code needed to install WordPress and set up the Apache web server to a different repository.
As I fell through the cracks of the age old discussion of getopt versus getopts I’ve also refined the two scripts to have a more comprehensible “interface” (still CLI commands though).

Installing WordPress

The WordPress installation script will rely on wp-cli to get the job done and will install WordPress with some sensible and overrideable defaults.
The wp-browser configuration file calls it covering all of the supported options:

  - wp-install --dir=/tmp/wordpress --dbname="$wpDbName" \
    --dbuser="root" --dbpass="" --dbprefix=wp_ \
    --domain="wordpress.dev" --title="Test" --base=/ \
    --admin_user=admin --admin_password=admin \
    [email protected] --theme=twentysixteen \
    --multisite --subdomains --empty 

The command options are named after the ones the config and install will accept and will be used to call the wp-cli command itself.
The only addition I’ve made is the --empty option: if specified the script will “empty” the just installed site of any post, plugin and theme save the activated one.

Next

Now that what can be reused I’ve refactored out I will finally set up Travis CI integration on a real WordPress plugin, the “I’d like this” one.

I appreciate your input