SimpleTest Automated Testing and Debugging in Drupal7

The solution I could find is fixing error_log in your test case class’s setUp() method with something like:

public function setUp() {

parent::setUp('modulename');

//-- Can't use 'file_public_path' because simpletest overrides it.
$logfile = conf_path() . '/files/test.log';
ini_set('log_errors', 1);
ini_set('error_log', $logfile);
}

which will allow you to log messages with error_log() to “sites/default/files/test.log” and may make using unit tests in Drupal relatively possible

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s