Testing

Updated: 14 July 2024

Fixtures

With “Arrange, Act, Assert”, fixtures are all the inputs and preconditions required before the object under test can be acted upon.

Unit Tests

phpunit & phpspec

This type of testing calls methods of an object. Test doubles are used in place of all but the simplest object dependencies of the class under test.

Integration Tests

phpunit

This type of testing calls methods on an object. Unlike unit testing, the real object dependencies of the class under test are used.

Functional Tests

phpunit & behat

This type of testing does not call the methods of an object directly. Instead, functional testing involves writing code which commands a http client or browser. The general cycle:

  1. Make a request.
  2. Click on a link or submit a form.
  3. Test the response.
  4. Reset fixtures and repeat.

Can also test an http API response.