// disable any left-over test extensions
CRM_Core_DAO::executeQuery('DELETE FROM civicrm_extension WHERE full_name LIKE "test.%"');
- $extensions = \CRM_Extension_System::singleton()->getManager();
- $api4Status = $extensions->getStatus('org.civicrm.api4');
- if ($api4Status != $extensions::STATUS_INSTALLED && $api4Status != $extensions::STATUS_UNKNOWN) {
- $extensions->enable(['org.civicrm.api4']);
- }
-
// reset all the caches
CRM_Utils_System::flushCache();
$_REQUEST = $_GET = $_POST = [];
error_reporting(E_ALL);
+ $this->renameLabels();
$this->_sethtmlGlobals();
}
*/
protected function tearDown() {
$this->_apiversion = 3;
+ $this->resetLabels();
error_reporting(E_ALL & ~E_NOTICE);
CRM_Utils_Hook::singleton()->reset();
'is_monetary' => 0,
'is_active' => 1,
'is_show_location' => 0,
+ 'is_email_confirm' => 1,
), $params);
return $this->callAPISuccess('Event', 'create', $params);
if (!isset($params['target_contact_id'])) {
$params['target_contact_id'] = $this->individualCreate(array(
'first_name' => 'Julia',
- 'Last_name' => 'Anderson',
+ 'last_name' => 'Anderson',
'prefix' => 'Ms.',
'email' => 'julia_anderson@civicrm.org',
'contact_type' => 'Individual',
return $csv;
}
+ /**
+ * Rename various labels to not match the names.
+ *
+ * Doing these mimics the fact the name != the label in international installs & triggers failures in
+ * code that expects it to.
+ */
+ protected function renameLabels() {
+ $replacements = ['Pending', 'Refunded'];
+ foreach ($replacements as $name) {
+ CRM_Core_DAO::executeQuery("UPDATE civicrm_option_value SET label = '{$name} Label**' where label = '{$name}' AND name = '{$name}'");
+ }
+ }
+
+ /**
+ * Undo any label renaming.
+ */
+ protected function resetLabels() {
+ CRM_Core_DAO::executeQuery("UPDATE civicrm_option_value SET label = REPLACE(name, ' Label**', '') WHERE label LIKE '% Label**'");
+ }
+
}