CiviCRM recently did some work for us to help build a better testing infrastructure within Civi. We're confident this can speed up development and make our changes more robust, and just need to finish the work out.
This is blocking many Q3 projects, since we want the testing to help us do a CiviCRM release upgrade safely.
- PHPUnit tests available for every input queue pipeline, using bundled test fixture data.
- Manually process any message type from drush, using a test fixture or other file
- Do not connect to the queue server.
- Do not require Drush or Simpletest, tests can be run by phpunit directly.
It would be a huge bonus if we could do without MySQL. The blocker here is that Civi does not support any other SQL syntax.
A phpunit.xml configuration file in the project's root directory will specify a bootstrap file in sites/default, which defines the DRUPAL_ROOT directory and makes the base wmf_common PHPUnit test case class available. Drupal bootstrapping is done with minimal code, without dependencies on Drush or Simpletest.
Self-contained unit tests may inherit PHPUnit_Framework_TestCase, but tests that need Drupal or database functionality should inherit from BaseWmfDrupalPhpUnitTestCase.
Drush single-message processing can be done using the new commands dpm, rpm, and rfdpm. The command will take a single argument, the path to a json file containing the message contents. See example messages in queue2civicrm/tests/data.
* cmdline option to drush jobs to synthesize or specify a new gateway_txn_id, to override the fixture data and prevent duplicate errors. We could eventually use this sort of instrumentation to trickle test transactions through our system and continually test it.
* I've probably trashed the existing SimpleTest-based cases. Refactor them to run under PHPUnit.