Add basic automated testing

Tests lifted more or less directly from https://drupal.org/node/1861608.