I have written a drupal module that uses the CiviCRM api. I want to build tests for my module. Drupal 7 includes the simpletest module in core, so I'm using that. I have created the following test:
class ExampleCiviCRMTestCase extends DrupalWebTestCase {
public static function getInfo(){
return array(
'name' => 'Example CiviCRM Test',
'description' => 'Check that CiviCRM API can be used in tests',
'group' => "CiviCRM",
);
}
public function setUp() {
parent::setUp(array('civicrm'));
}
public function testCivicrmWorks(){
civicrm_initialize();
try {
$result = civicrm_api3('Contact', 'get', array(
'sequential' => 1,
));
} catch (CiviCRM_API3_Exception $e) {
$error = $e->getMessage();
$this->fail($error);
}
$this->assertFalse(empty($result['count']));
}
}
This test fails. The error page states that the civicrm module was successfully enabled, but then this error occured:
Access to undeclared static property: Database::$ignoreTargets
. The error occured in database.inc on line 1473. Does anyone have any experience using simpletest with civicrm?