Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 3.27 KB

File metadata and controls

67 lines (52 loc) · 3.27 KB

Development on SwG WordPress Plugin

How to get started

Before you start developing in SwG WordPress Plugin, check out these resources:

  • CONTRIBUTING.md has details on various ways you can contribute to the SwG WordPress Plugin.
  • If you're developing in SwG WordPress Plugin, you should read the Contributing code.

Setup

  • Install a working WordPress 4.7+ site with PHP 5.6+
  • Install Composer
  • Install PHP dependencies with composer
  • Install PHP test coverage support with pecl install xdebug
  • Run the ./tests/bin/run-wp-unit-tests.sh script once, make sure it can connect to MySQL. By default it will try using the credentials root/root, but feel free to change this as needed in your local development environment. NOTE: You will have to run this again if the /tmp directory gets cleared.
  • Install Nodejs
  • Install Yarn
  • Install JavaScript dependencies with yarn
  • Compile JavaScript and CSS with yarn watch
  • Now the plugin is ready to test on your WP site!

Optional: Using VS Code

  • Install VS Code
  • Open the plugin directory in VS Code
  • Install PHP Intelephense plugin (bmewburn.vscode-intelephense-client)
  • Install PHP Sniffer plugin (wongjn.php-sniffer)
  • Install ESLint plugin (dbaeumer.vscode-eslint)

Bash commands

Use the following Bash commands:

Command Description
yarn watch Compiles JS and CSS, then watches for changes.
yarn test Runs JS tests and prints coverage report to console.
composer test Runs PHP tests.
composer coverage Runs PHP tests and generates an HTML coverage report.
composer lint Validates PHP with PHPCS.
composer lint-fix Automatically fixes (most) PHP linting issues with PHPCS.

Repository Layout

  assets/         - source code and tests for JS and CSS
  gulp-tasks/     - build infrastructure
  includes/       - source code for PHP
  tests/          - tests for PHP