A WordPress plugin for the AMO blog.
Перейти к файлу
Mathieu Pillard a7ef47697a
Merge pull request #17 from mozilla/enable-dependabot
Create dependabot.yml
2023-01-10 16:51:28 +01:00
.circleci Merge branch 'main' into 11-update-circleci-images-to-cimg 2022-03-11 13:57:31 +00:00
.github Create dependabot.yml 2023-01-10 15:38:19 +01:00
bin update test files (#12) 2022-03-11 14:16:51 +01:00
tests update test files (#12) 2022-03-11 14:16:51 +01:00
.gitignore Add WordPress tests (#5) 2021-04-30 13:37:20 +02:00
.prettierignore Add WordPress tests (#5) 2021-04-30 13:37:20 +02:00
.prettierrc Add WordPress tests (#5) 2021-04-30 13:37:20 +02:00
LICENSE.txt initial commit 2021-03-25 09:12:02 +01:00
Makefile Use -f in 'make clean' 2021-05-06 09:47:28 +02:00
README.md Run test suite with WordPress 5.8.3 (current prod version) (#13) 2022-03-11 14:34:19 +01:00
addons-wp-headless.php Prepare 3.0.1 release 2021-05-06 09:57:58 +02:00
composer.json update test files (#12) 2022-03-11 14:16:51 +01:00
composer.lock update test files (#12) 2022-03-11 14:16:51 +01:00
package.json Add WordPress tests (#5) 2021-04-30 13:37:20 +02:00
phpunit.xml.dist Add name in phpunit.xml.dist (#14) 2022-03-11 14:46:07 +01:00
yarn.lock update test files (#12) 2022-03-11 14:16:51 +01:00

README.md

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

License

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