Skip to content

Building and Testing

Jason Stallings edited this page Dec 29, 2016 · 8 revisions

Building

For building there isn't much you need to do. Just install the dependencies:

composer install --no-dev

Then create a zip of the plugin! There are a number of files in the repository that don't need to be in the zip. The required files/directories are:

wpengine-phpcompat.php
vendor/
src/
uninstall.php

When you make changes to the readme.txt you should rebuild the readme.md for GitHub. You can do this using a Grunt command. First install the dependencies:

npm install

Then run the command:

npm run readme

or:

grunt readme

Testing

First make sure you have all of the dependencies installed:

composer install
npm install

To run the whole test suite you need to have MySQL running for WordPress. With MySQL running you can run this command to set up the environment:

bash tests/bin/install-wp-tests.sh <database_name> <mysql_user> <mysql_password> <mysql_host> <wordpress_version>

This will download WordPress and create a database to be used while running tests. You can learn more about this here.

Once the environment is set up you can run the tests:

phpunit
npm test

This will run the WordPress integration tests, the QUnit tests, check for PHP syntax errors, and check for WordPress standards violations.

Here's how you can run the individual tests:

WordPress Tests:

phpunit

QUnit:

You can open tests/qunit/index.html in any browser, or use the headless runner:

npm run test:qunit
```
WordPress Code Standards: 

```
grunt phpcs
```

PHP Lint: 

```
grunt phplint
```



 
Clone this wiki locally