This project is not covered by Drupal’s security advisory policy.

twistor's unit testing helpers.

8.x has PHPunit. 7.x does not.

TUnit is a collection of hacks to help unit testing for 7.x.

Just add this to your info file to begin using TUnit in your tests.
test_dependencies[] = tunit

You still need it installed locally to run tests locally.

Features

  • TUnit::newInstanceWithoutConstructor($class)
  • TUnit::getProperty($object, $property)
  • TUnit::setProperty($object, $property, $value)
  • TUnit::invokeMethod($object, $method, $arguments)
  • A copy of $conf is created and automatically restored after a test run.
  • TUnit::variableGet($name, $default)
  • TUnit::variableSet($name, $value)
  • TUnit::variableDel($name)
  • TUnit::assertException($callable, $args, $exception_class, $message)
  • Drupal's class autoloader is automatically unregistered before every test run so that class_exists() calls won't trigger database errors.

Suggestions are more than welcome.

Project information

Releases