Skip to content

Building and Testing

Jason Stallings edited this page Jul 24, 2018 · 8 revisions

Testing

First you'll need to start the Docker container:

make start

Then inside the container install the dependencies:

make shell
composer install
npm install

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

You can also open WordPress and test the plugin manually by going to: http://localhost:8081

Building

For building there is an included script, build.sh. Run this and you'll end up with a zip in the root called phpcompat.zip.

./build.sh

You'll also have a copy of the WordPress.org SVN repo in the build subdirectory with the latest changes copied over.

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

Steps for releasing a new plugin version:

  1. Update changelog in readme.txt.
  2. Update upgrade notice in readme.txt.
  3. Bump plugin version in readme.txt.
  4. Bump plugin version in wpengine-phpcompat.php.
  5. Rebuild readme.md using npm run readme.
  6. Add new files to the SVN repo by running svn add ./ --force in build/trunk
  7. Commit the new files: svn ci -m 'v1.4.6', replace 1.4.6 with the new version number.
  8. Tag the new release by running the following commands in the build subdirectory:
svn cp trunk tags/1.4.6
svn ci -m "tagging version 1.4.6"
Clone this wiki locally