2

I'm writing an application that is using Drupal APIs to connect to an external database and doing a bunch of stuff with this data (reading/writing/deleting). I was wondering if there are any best practices for writing simpletests in Drupal 7 with this kind of application. I know simpletest basically installs a new instance of Drupal, then uses this sandbox environment to do testing. However none of the schema for this external database is defined in drupal.

Any tips on how I can test against this database, and not have a bunch of left over data when tests complete?

1 Answer 1

2

User the setUp and tearDown methods to setup and tear down your external db.

A typical thing would be to write code that first empties the db and then populates it with the test data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.