/** * Validate that the API call for updating the header text for multiple * configured custom profile fields works as expected */ public function test_version1exportupdatesheaders() { global $CFG, $DB; $file = get_plugin_directory('dhexport', 'version1') . '/lib.php'; require_once $file; // Set up the category and field, along with the export mapping. $categoryid = $this->create_custom_field_category(); $firstfldid = $this->create_profile_field('rliptext', 'text', $categoryid); $this->create_field_mapping($firstfldid); // Set up a second field and mapping record. $secondfldid = $this->create_profile_field('rliptext2', 'text', $categoryid); $this->create_field_mapping($secondfldid, 'Header2', 2); // Obtain DB record ids. $firstid = $DB->get_field(RLIPEXPORT_VERSION1_FIELD_TABLE, 'id', array('fieldid' => $firstfldid)); $secondid = $DB->get_field(RLIPEXPORT_VERSION1_FIELD_TABLE, 'id', array('fieldid' => $secondfldid)); // Update the headers. $data = array('header_' . $firstid => 'Updatedvalue1', 'header_' . $secondid => 'Updatedvalue2'); rlipexport_version1_config::update_field_headers($data); // Validation. $this->assert_record_exists(RLIPEXPORT_VERSION1_FIELD_TABLE, array('fieldid' => $firstfldid, 'header' => 'Updatedvalue1')); $this->assert_record_exists(RLIPEXPORT_VERSION1_FIELD_TABLE, array('fieldid' => $secondfldid, 'header' => 'Updatedvalue2')); }