Skip to content

ode for the workshop "An Introduction to Unit Testing (for WordPress)" at WordCamp Europe 2018.

License

Notifications You must be signed in to change notification settings

apermo/wceu-2018-unit-testing

 
 

Repository files navigation

Unit Testing Workshop

Code for the workshop "An Introduction to Unit Testing (for WordPress)" at WordCamp Europe 2018.

Requirements

To be able to do the exercises in this workshop, you need to meet some requirements.

PHP Requirements

In order to run the PHP tests, you need to have installed the following:

  • PHP 5.6 or higher (available via command line)
  • Composer

JavaScript Requirements

In order to run the JavaScript tests, you need to have installed the following:

  • Node v6.0.0 or higher (available via command line)
  • Yarn (optional)

Installation

Here are the steps to install and set up your environment for the workshop:

  1. Clone (or download) this repository to your computer.
  2. In your terminal, go to the root directory of this repository.
  3. Install the dependencies:
    • For PHP, run composer install.
    • For JavaScript, run yarn (or npm i).

You can test if everything is working by attempting to run one of the exercises as described in the next section.

Running the Tests

Each exercise has its own test suite/file. To run a specific exercise, perform the according command from the root directory of the repository, as explained below.

Running PHP Tests

For each PHP exercise, there is a dedicated test suite, named exercise1 to exercise3. The generic command to run a specific test suite is as follows:

./vendor/bin/phpunit --testsuite exerciseX

Replace the "X" in exerciseX with the exercise number. So, for example, running the test suite for exercise 1 would be this:

./vendor/bin/phpunit --testsuite exercise1

Running JavaScript Tests

For each JavaScript exercise, there are one or more dedicated test files, named exercise1/SOMETHING.test.js etc. The generic command to run a specific test suite is as follows:

./node_modules/.bin/jest exerciseX

Replace the "X" in exerciseX with the exercise number. So, for example, running the test suite for exercise 1 would be this:

./node_modules/.bin/jest exercise1

Documentation

Throughout the workshop, you might want to refer to the official documentation of the tools you are using.

PHP-specific Documentation

JavaScript-specific Documentation

Have Fun!

Thorsten, Carl, and Giuseppe

About

ode for the workshop "An Introduction to Unit Testing (for WordPress)" at WordCamp Europe 2018.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 67.5%
  • PHP 32.5%