Skip to content

Latest commit

 

History

History
63 lines (38 loc) · 1.93 KB

CONTRIBUTING.md

File metadata and controls

63 lines (38 loc) · 1.93 KB

Contribute

Whether you want to fix a bug or implement a new feature, the process is pretty much the same:

  1. Search existing issues; if you can't find anything related to what you want to work on, open a new issue so that you can get some initial feedback.
  2. Fork the repository.
  3. Make the code changes in your fork.
  4. Open a pull request.

It doesn't matter if the code isn't perfect. The idea is to get it reviewed early and iterate on it.

If you're adding a new feature, please add one or more functional tests for it in the features/ directory. See below.

Lastly, please follow the WordPress Coding Standards.

Running and writing tests

There are two types of automated tests:

  • unit tests, implemented using PHPUnit
  • functional tests, implemented using Behat

To set everything up, just run:

./utils/dev-build

Unit tests

The unit test files are in the tests/ directory.

To run the unit tests, just execute:

php phpunit.phar

Functional tests

The functional test files are in the features/ directory.

Before running the functional tests, you'll need a MySQL user called wp_cli_test with the password password1 that has full privileges on the MySQL database wp_cli_test. Running the following as root in MySQL should do the trick:

GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1";

Then, to run the entire test suite:

php behat.phar --expand

Or to test a single feature:

php behat.phar features/core.feature

More info can be found from php behat.phar --help.

Finally...

Thanks! Hacking on WP-CLI should be fun. If you find any of this hard to figure out, let us know so we can improve our process or documentation!