/**
* Set up baseline for testing
*/
- public function setUp() {
+ public function setUp(): void {
$tablesToTruncate = [
+ 'civicrm_case_type',
'civicrm_custom_group',
'civicrm_custom_field',
'civicrm_group',
$this->dropByPrefix('civicrm_value_myfavorite');
$this->cleanup(['tablesToTruncate' => $tablesToTruncate]);
$this->setUpOptionCleanup();
+ $this->loadDataSet('CaseType');
$this->loadDataSet('ConformanceTest');
$this->creationParamProvider = \Civi::container()->get('test.param_provider');
parent::setUp();
*/
public function getEntitiesHitech() {
// Ensure all components are enabled so their entities show up
- \CRM_Core_BAO_ConfigSetting::enableComponent('CiviEvent');
- \CRM_Core_BAO_ConfigSetting::enableComponent('CiviGrant');
- \CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
- \CRM_Core_BAO_ConfigSetting::enableComponent('CiviContribute');
- \CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
- \CRM_Core_BAO_ConfigSetting::enableComponent('CiviPledge');
- \CRM_Core_BAO_ConfigSetting::enableComponent('CiviReport');
+ foreach (array_keys(\CRM_Core_Component::getComponents()) as $component) {
+ \CRM_Core_BAO_ConfigSetting::enableComponent($component);
+ }
return $this->toDataProviderArray(Entity::get(FALSE)->execute()->column('name'));
}
public function getEntitiesLotech() {
$manual['add'] = [];
$manual['remove'] = ['CustomValue'];
+ $manual['transform'] = ['CiviCase' => 'Case'];
$scanned = [];
$srcDir = dirname(__DIR__, 5);
foreach ((array) glob("$srcDir/Civi/Api4/*.php") as $name) {
- $scanned[] = preg_replace('/\.php/', '', basename($name));
+ $fileName = basename($name, '.php');
+ $scanned[] = $manual['transform'][$fileName] ?? $fileName;
}
$names = array_diff(
$this->assertNotEmpty($info['title_plural']);
$this->assertNotEmpty($info['type']);
$this->assertNotEmpty($info['description']);
+ $this->assertContains($info['searchable'], ['primary', 'secondary', 'none']);
+ // Bridge must be between exactly 2 entities
+ if (in_array('EntityBridge', $info['type'], TRUE)) {
+ $this->assertCount(2, $info['bridge']);
+ }
}
/**
$errMsg = sprintf('%s is missing required ID field', $entity);
$subset = ['data_type' => 'Integer'];
- $this->assertArraySubset($subset, $fields['id'], $errMsg);
+ $this->assertArrayHasKey('data_type', $fields['id'], $errMsg);
+ $this->assertEquals('Integer', $fields['id']['data_type']);
}
/**
catch (\API_Exception $e) {
$exceptionThrown = $e->getMessage();
}
- $this->assertContains('id', $exceptionThrown);
+ $this->assertStringContainsString('id', $exceptionThrown);
}
/**
catch (\API_Exception $e) {
$exceptionThrown = $e->getMessage();
}
- $this->assertContains('required', $exceptionThrown);
+ $this->assertStringContainsString('required', $exceptionThrown);
}
/**
catch (\API_Exception $e) {
$exceptionThrown = $e->getMessage();
}
- $this->assertContains('debug', $exceptionThrown);
- $this->assertContains('type', $exceptionThrown);
+ $this->assertStringContainsString('debug', $exceptionThrown);
+ $this->assertStringContainsString('type', $exceptionThrown);
}
/**