Download the PHP package voceconnect/wp-qa-suite without Composer
On this page you can find all versions of the php package voceconnect/wp-qa-suite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download voceconnect/wp-qa-suite
More information about voceconnect/wp-qa-suite
Files in voceconnect/wp-qa-suite
Package wp-qa-suite
Short Description Install scripts and commands for basic quality checks and testing for WordPress projects
License
Informations about the package wp-qa-suite
wp-qa-suite
A set of scripts to facilitate the ease of adding syntax checking, unit testing, and code sniffs to a given WordPress project theme or plugin.
The wp-qa-suite
provides a consistent way for projects to include continuous integration functionality with something like Travis CI without needing to write BASH statements. Since wp-qa-suite
can be installed via Composer, this makes updating wp-qa-suite
for multiple projects easy.
Setup
1) Add a composer.json
file to install the wp-qa-suite
, example:
2) Execute composer install --dev
Scripts
bin/wp-qa-codesniff
Reads a phpcs.ruleset.xml
from the root of the project and executes phpcs
against only PHP files in the project using git ls-tree
. WordPress-Coding-Standards/WordPress-Coding-Standards are installed and added to the installed_paths
configuration of phpcs
.
bin/wp-qa-phpunit
Installs the latest or a specific version of WordPress, the WordPress test suite, sets up the database, and executes phpunit --configuration phpunit.xml
. Settings are read from a phpunit.xml
stored in the project root.
Arguments:
wp_version
- (required) the version of WordPress to test against,3.9.2
,3.8.4
, etc. orlatest
.DB_USER
- (optional, default: travis) the username to use when connecting to MySQLDB_PASS
- (optional, default: none) the password for theDB_USER
to use when connecting to MySQLDB_NAME
- (optional, default: wp_test) the MySQL database name to use for testsDB_HOST
- (optional, default: localhost) the host running the MySQL instance to connect to
bin/wp-qa-syntax
Executes syntax checks against all PHP files in the project. Since git ls-tree
is used, the script will only scan over files included in the project and not dependencies installed via Composer.
Integrating with Travis CI
An example .travis.yml
file:
The .travis.yml
file specifies how the application should be tested in Travis CI.
In the example within this repository, we want to test our plugin against PHP versions 5.4
and 5.5
:
We can also tests against different versions of WordPress by specifying an environment variable, WP_VERSION
. The WP_VERSION
environment variable is passed to the wp-qa-phpunit
script and used to retrieve the latest or specific version of WordPress.
The before_script
section of the .travis.yml
file should be used to 'setup' or 'prep' the test environment, in this case it is used to install Composer dependencies.
The script
section of the .travis.yml
file specifies what should be executed that constitutes "tests" or a "build". If these commands return an exit status that doesn't equal 0, this results in the build "failing".
In this example, we want to execute a check of all the PHP files for correct syntax, followed by execution of PHP unit tests.