Skip to content

Development

Javier Prieto edited this page Mar 22, 2021 · 1 revision

Important: This documentation is still under construction, methods and/or properties may be missing or not fully documented


This is a more technical documentation, in this document is assumed that you already changed your terminal to your plugin root directory.

Requirements

  • WP-CLI, to install, follow this instructions.
  • Composer, to install, follow this instructions.

Install dependencies

To install all dependencies you must run:

composer install

PHPUnit tests

Run the installation script:

bin/install-wp-tests.sh dbname dbuser dbpass dbhost latest

Where

  • dbname – This is the name of the database that will be created.
  • dbuser - Our MySQL username.
  • dbpass - Our MySQL password.
  • dbhost - The MySQL server host.
  • lastest - The version of WordPress to install.

Run the Sample Unit Test

PHPUnit 7.x is installed as development dependency to avoid conflict with another version installed in your system. To run the tests associated with our plugin run the following command:

php vendor/phpunit/phpunit/phpunit

Generate a .POT file

To generate a .POT file to add translations to this plugin run this:

wp i18n make-pot .

Create a distribution archive

Previous to generate you need install wp dist-archive package command, to do this run:

wp package install wp-cli/dist-archive-command

To create a distribution zip archive in wp-content/plugins/ based on the plugin's .distignore file run this:

composer install --no-dev --optimize-autoloader
wp dist-archive .