Skip to content

Repository files navigation

addons-wp-headless

CircleCI

A WordPress plugin for the AMO blog.

Usage

Install the plugin in the WordPress admin panel by uploading the zip file.

Development

Important: you'll need composer to install the project's dev dependencies.

Running the test suite

This is a bit involved because there is no nice way to write "unit" tests with WordPress. We follow the recommended approach, which requires both a WordPress instance and MySQL database. The bin/install-wp-tests.sh script can be used to download and setup the WP instance as well as create the "test" database, which requires a local MySQL server, e.g. with Docker:

$ docker run --name mysql_addons_wp_headless -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_DATABASE=addons_wp_headless -p 55001:3306 --rm mysql

Assuming you have a MySQL server running locally using the docker command above, run the following commands once:

# `5.8.3` is the WordPress version, use `latest` for the latest version or any
# other version if you like.
# `true` at the end of the command below skips the database creation since it is
# created when the docker container starts
$ ./bin/install-wp-tests.sh addons_wp_headless root pass '127.0.0.1:55001' 5.8.3 true
$ composer install

Then, you can run the test suite with PHPUnit:

$ ./vendor/bin/phpunit

Build the plugin (zip file)

$ make

Making a release

  • Edit the PHPdoc comment in addons-wp-headless.php to bump the version number, push a commit with that change to master
  • Create a GitHub release with that version number from master
  • Check out the tag automatically created by the GitHub release

You can then build the plugin and upload the new zip file to the WordPress admin panel as described above.

License

This plugin is released under the Mozilla Public License Version 2.0. See the bundled LICENSE file for details.

About

A WordPress plugin for the AMO blog.

Resources

Code of conduct

Stars

6 stars

Watchers

4 watching

Forks

Releases

Used by

Contributors

Languages