/** * @param boolean|string $overwrite ; TRUE (always overwrite), FALSE (preserve with error), 'ignore' (preserve quietly) */ function __construct($customGroupIds, $ufGroupIds, $path, $overwrite) { $this->customGroupIds = $customGroupIds; $this->ufGroupIds = $ufGroupIds; $this->path = $path; $this->overwrite = $overwrite; $this->export = new \CRM_Utils_Migrate_Export(); $this->export->buildCustomGroups($this->customGroupIds); $this->export->buildUFGroups($this->ufGroupIds); }
/** * Execute a basic XML test case. Each test case creates a custom-group and * custom-field then compares the output to a pre-defined XML file. * * @param $customGroupParams * @param $fieldParams * @param $expectedXmlFilePath * @dataProvider basicXmlTestCases */ function testBasicXMLExports($customGroupParams, $fieldParams, $expectedXmlFilePath) { $this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_custom_group WHERE title = %1', array(1 => array($customGroupParams['title'], 'String'))); $customGroup = $this->customGroupCreate($customGroupParams); $fieldParams['custom_group_id'] = $customGroup['id']; $customField = $this->callAPISuccess('custom_field', 'create', $fieldParams); $exporter = new CRM_Utils_Migrate_Export(); $exporter->buildCustomGroups(array($customGroup['id'])); // print $exporter->toXML(); $this->assertEquals(file_get_contents($expectedXmlFilePath), $exporter->toXML()); $this->callAPISuccess('custom_field', 'delete', array('id' => $customField['id'])); $this->callAPISuccess('custom_group', 'delete', array('id' => $customGroup['id'])); }