本文整理汇总了PHP中PHPUnit_Extensions_Database_Operation_Insert::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Extensions_Database_Operation_Insert::execute方法的具体用法?PHP PHPUnit_Extensions_Database_Operation_Insert::execute怎么用?PHP PHPUnit_Extensions_Database_Operation_Insert::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Extensions_Database_Operation_Insert
的用法示例。
在下文中一共展示了PHPUnit_Extensions_Database_Operation_Insert::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCheckParamsWithDuplicateContact2
/**
* Test civicrm_contact_check_params with a duplicate.
* and request the error in array format
*/
public function testCheckParamsWithDuplicateContact2()
{
// Insert a row in civicrm_contact creating individual contact
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, $this->createXMLDataSet(dirname(__FILE__) . '/../../api/v3/dataset/contact_17.xml'));
$op->execute($this->_dbconn, $this->createXMLDataSet(dirname(__FILE__) . '/../../api/v3/dataset/email_contact_17.xml'));
$params = array('first_name' => 'Test', 'last_name' => 'Contact', 'email' => 'TestContact@example.com', 'contact_type' => 'Individual');
$contact = _civicrm_api3_deprecated_contact_check_params($params, TRUE, TRUE);
$this->assertEquals(1, $contact['is_error']);
$this->assertRegexp("/matching contacts.*17/s", $contact['error_message']['message']);
}
示例2: setUp
protected function setUp()
{
parent::setUp();
$this->quickCleanup(array('civicrm_group', 'civicrm_contact', 'civicrm_uf_group', 'civicrm_uf_field', 'civicrm_uf_join', 'civicrm_uf_match'));
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml'));
$this->callAPISuccess('uf_field', 'getfields', array('cache_clear' => 1));
$this->_params = array('field_name' => 'phone', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', 'weight' => 1, 'label' => 'Test Phone', 'is_searchable' => 1, 'is_active' => 1, 'location_type_id' => 1, 'phone_type_id' => 1, 'uf_group_id' => $this->_ufGroupId);
}
示例3: setUp
/**
* Test setup for every test
*
* Connect to the database, truncate the tables that will be used
* and redirect stdin to a temporary file
*/
public function setUp()
{
// Connect to the database
parent::setUp();
$this->quickCleanup(array('civicrm_address_format', 'civicrm_currency', 'civicrm_domain', 'civicrm_file', 'civicrm_financial_account', 'civicrm_financial_trxn', 'civicrm_job', 'civicrm_job_log', 'civicrm_location_type', 'civicrm_mail_settings', 'civicrm_mapping', 'civicrm_navigation', 'civicrm_option_group', 'civicrm_payment_processor', 'civicrm_payment_processor_type', 'civicrm_preferences_date', 'civicrm_worldregion', 'civicrm_component', 'civicrm_persistent', 'civicrm_prevnext_cache', 'civicrm_action_mapping', 'civicrm_acl', 'civicrm_acl_entity_role', 'civicrm_contact', 'civicrm_acl_contact_cache', 'civicrm_relationship_type', 'civicrm_saved_search', 'civicrm_contact_type', 'civicrm_mailing_component', 'civicrm_mailing_bounce_type', 'civicrm_mailing_bounce_pattern', 'civicrm_financial_type', 'civicrm_premiums', 'civicrm_product', 'civicrm_premiums_product', 'civicrm_sms_provider', 'civicrm_membership_status', 'civicrm_campaign', 'civicrm_campaign_group', 'civicrm_survey', 'civicrm_participant_status_type', 'civicrm_event_carts', 'civicrm_dedupe_rule_group', 'civicrm_dedupe_rule', 'civicrm_dedupe_exception', 'civicrm_case', 'civicrm_case_contact', 'civicrm_grant', 'civicrm_tell_friend', 'civicrm_pledge_block', 'civicrm_queue_item', 'civicrm_report_instance', 'civicrm_price_set', 'civicrm_price_set_entity', 'civicrm_pcp', 'civicrm_batch', 'civicrm_cache', 'civicrm_country', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_dashboard', 'civicrm_email', 'civicrm_entity_batch', 'civicrm_entity_file', 'civicrm_entity_financial_trxn', 'civicrm_im', 'civicrm_log', 'civicrm_mapping_field', 'civicrm_menu', 'civicrm_note', 'civicrm_option_value', 'civicrm_phone', 'civicrm_state_province', 'civicrm_tag', 'civicrm_uf_match', 'civicrm_timezone', 'civicrm_openid', 'civicrm_discount', 'civicrm_website', 'civicrm_setting', 'civicrm_acl_cache', 'civicrm_dashboard_contact', 'civicrm_group', 'civicrm_subscription_history', 'civicrm_group_contact_cache', 'civicrm_group_nesting', 'civicrm_group_organization', 'civicrm_relationship', 'civicrm_mailing_event_subscribe', 'civicrm_mailing_event_confirm', 'civicrm_contribution_recur', 'civicrm_contribution_page', 'civicrm_contribution_widget', 'civicrm_activity', 'civicrm_activity_contact', 'civicrm_case_activity', 'civicrm_pledge', 'civicrm_price_field', 'civicrm_county', 'civicrm_entity_tag', 'civicrm_msg_template', 'civicrm_uf_group', 'civicrm_uf_field', 'civicrm_uf_join', 'civicrm_action_schedule', 'civicrm_action_log', 'civicrm_mailing', 'civicrm_mailing_group', 'civicrm_mailing_trackable_url', 'civicrm_mailing_job', 'civicrm_mailing_recipients', 'civicrm_mailing_spool', 'civicrm_mailing_event_queue', 'civicrm_mailing_event_bounce', 'civicrm_mailing_event_delivered', 'civicrm_mailing_event_forward', 'civicrm_mailing_event_opened', 'civicrm_mailing_event_reply', 'civicrm_mailing_event_trackable_url_open', 'civicrm_mailing_event_unsubscribe', 'civicrm_membership_type', 'civicrm_membership', 'civicrm_membership_block', 'civicrm_membership_log', 'civicrm_price_field_value', 'civicrm_line_item', 'civicrm_pcp_block', 'civicrm_address', 'civicrm_loc_block', 'civicrm_group_contact', 'civicrm_contribution', 'civicrm_contribution_product', 'civicrm_contribution_soft', 'civicrm_membership_payment', 'civicrm_event', 'civicrm_participant', 'civicrm_participant_payment', 'civicrm_events_in_carts', 'civicrm_pledge_payment'));
// Insert test data
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/dataset/data.xml'));
}
示例4: setUp
protected function setUp()
{
parent::setUp();
// Truncate the tables
$this->quickCleanup(array('civicrm_group', 'civicrm_contact', 'civicrm_uf_group', 'civicrm_uf_join', 'civicrm_uf_match'));
$this->_apiversion = 3;
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml'));
}
示例5: setUp
protected function setUp()
{
parent::setUp();
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml'));
// FIXME: something NULLs $GLOBALS['_HTML_QuickForm_registered_rules'] when the tests are ran all together
$GLOBALS['_HTML_QuickForm_registered_rules'] = array('required' => array('html_quickform_rule_required', 'HTML/QuickForm/Rule/Required.php'), 'maxlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'), 'minlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'), 'rangelength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'), 'email' => array('html_quickform_rule_email', 'HTML/QuickForm/Rule/Email.php'), 'regex' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), 'lettersonly' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), 'alphanumeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), 'numeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), 'nopunctuation' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), 'nonzero' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), 'callback' => array('html_quickform_rule_callback', 'HTML/QuickForm/Rule/Callback.php'), 'compare' => array('html_quickform_rule_compare', 'HTML/QuickForm/Rule/Compare.php'));
// FIXME: …ditto for $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES']
$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] = array('group' => array('HTML/QuickForm/group.php', 'HTML_QuickForm_group'), 'hidden' => array('HTML/QuickForm/hidden.php', 'HTML_QuickForm_hidden'), 'reset' => array('HTML/QuickForm/reset.php', 'HTML_QuickForm_reset'), 'checkbox' => array('HTML/QuickForm/checkbox.php', 'HTML_QuickForm_checkbox'), 'file' => array('HTML/QuickForm/file.php', 'HTML_QuickForm_file'), 'image' => array('HTML/QuickForm/image.php', 'HTML_QuickForm_image'), 'password' => array('HTML/QuickForm/password.php', 'HTML_QuickForm_password'), 'radio' => array('HTML/QuickForm/radio.php', 'HTML_QuickForm_radio'), 'button' => array('HTML/QuickForm/button.php', 'HTML_QuickForm_button'), 'submit' => array('HTML/QuickForm/submit.php', 'HTML_QuickForm_submit'), 'select' => array('HTML/QuickForm/select.php', 'HTML_QuickForm_select'), 'hiddenselect' => array('HTML/QuickForm/hiddenselect.php', 'HTML_QuickForm_hiddenselect'), 'text' => array('HTML/QuickForm/text.php', 'HTML_QuickForm_text'), 'textarea' => array('HTML/QuickForm/textarea.php', 'HTML_QuickForm_textarea'), 'fckeditor' => array('HTML/QuickForm/fckeditor.php', 'HTML_QuickForm_FCKEditor'), 'tinymce' => array('HTML/QuickForm/tinymce.php', 'HTML_QuickForm_TinyMCE'), 'dojoeditor' => array('HTML/QuickForm/dojoeditor.php', 'HTML_QuickForm_dojoeditor'), 'link' => array('HTML/QuickForm/link.php', 'HTML_QuickForm_link'), 'advcheckbox' => array('HTML/QuickForm/advcheckbox.php', 'HTML_QuickForm_advcheckbox'), 'date' => array('HTML/QuickForm/date.php', 'HTML_QuickForm_date'), 'static' => array('HTML/QuickForm/static.php', 'HTML_QuickForm_static'), 'header' => array('HTML/QuickForm/header.php', 'HTML_QuickForm_header'), 'html' => array('HTML/QuickForm/html.php', 'HTML_QuickForm_html'), 'hierselect' => array('HTML/QuickForm/hierselect.php', 'HTML_QuickForm_hierselect'), 'autocomplete' => array('HTML/QuickForm/autocomplete.php', 'HTML_QuickForm_autocomplete'), 'xbutton' => array('HTML/QuickForm/xbutton.php', 'HTML_QuickForm_xbutton'), 'advmultiselect' => array('HTML/QuickForm/advmultiselect.php', 'HTML_QuickForm_advmultiselect'));
}
示例6: setUp
protected function setUp()
{
parent::setUp();
$this->_apiversion = 3;
$this->quickCleanup(array('civicrm_group', 'civicrm_contact', 'civicrm_uf_group', 'civicrm_uf_join', 'civicrm_uf_match'));
$this->_contactId = $this->individualCreate();
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml'));
$this->_params = array('contact_id' => $this->_contactId, 'uf_id' => '2', 'uf_name' => 'blahdyblah@gmail.com', 'domain_id' => 1);
}
示例7: execute
public function execute(\PHPUnit_Extensions_Database_DB_IDatabaseConnection $connection, \PHPUnit_Extensions_Database_DataSet_IDataSet $dataSet)
{
foreach ($dataSet->getTableNames() as $tableName) {
$connection->getConnection()->query("Alter Table {$tableName} NOCHECK Constraint All");
}
parent::execute($connection, $dataSet);
foreach ($dataSet->getTableNames() as $tableName) {
$connection->getConnection()->query("Alter Table {$tableName} CHECK Constraint All");
}
}
示例8: testAllIMs
/**
* AllIMs() method - get all IMs for our contact, with primary IM first
*/
public function testAllIMs()
{
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/im_test.xml'));
$contactId = 69;
$IMs = CRM_Core_BAO_IM::allIMs($contactId);
$this->assertEquals(count($IMs), 3, 'Checking number of returned IMs.');
$firstIMValue = array_slice($IMs, 0, 1);
$this->assertEquals('alan1.smith1', $firstIMValue[0]['name'], 'Confirm primary IM value.');
$this->assertEquals(1, $firstIMValue[0]['is_primary'], 'Confirm first IM is primary.');
$this->contactDelete($contactId);
}
示例9: setUp
/**
* Test setup for every test
*
* Connect to the database, truncate the tables that will be used
* and redirect stdin to a temporary file
*/
public function setUp()
{
$this->_entity = 'case';
parent::setUp();
// CRM-9404 - set-up is a bit cumbersome but had to put something in place to set up activity types & case types
//. Using XML was causing breakage as id numbers were changing over time
// & was really hard to troubleshoot as involved truncating option_value table to mitigate this & not leaving DB in a
// state where tests could run afterwards without re-loading.
$this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_status', 'format.only_id' => 1));
$this->caseTypeGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_type', 'format.only_id' => 1));
$caseTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => $this->caseTypeGroup, 'name' => 'housing_support', 'label' => "Housing Support", 'sequential' => 1, 'description' => 'Help homeless individuals obtain temporary and long-term housing'));
$this->caseTypeId = $caseTypes['values'][0]['value'];
$this->optionValues[] = $caseTypes['id'];
$optionValues = array('Medical evaluation' => 'Medical evaluation', 'Mental health evaluation' => "Mental health evaluation", 'Secure temporary housing' => 'Secure temporary housing', 'Long-term housing plan' => 'Long-term housing plan', 'ADC referral' => 'ADC referral', 'Income and benefits stabilization' => 'Income and benefits stabilization');
foreach ($optionValues as $name => $label) {
$activityTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => 2, 'name' => $name, 'label' => $label, 'component_id' => 7));
// store for cleanup
$this->optionValues[] = $activityTypes['id'];
}
$tablesToTruncate = array('civicrm_activity', 'civicrm_contact', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_case', 'civicrm_case_contact', 'civicrm_case_activity', 'civicrm_activity_contact', 'civicrm_relationship', 'civicrm_relationship_type');
$this->quickCleanup($tablesToTruncate);
$activityTypes = $this->callAPISuccess('option_value', 'get', array('option_group_id' => 2, 'name' => 'Follow Up', 'label' => 'Follow Up', 'sequential' => 1));
$this->followup_activity_type_value = $activityTypes['values'][0]['value'];
// Insert a row in civicrm_contact creating contact 17
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/contact_17.xml'));
//Create relationship types
$relTypeParams = array('name_a_b' => 'Case Coordinator is', 'label_a_b' => 'Case Coordinator is', 'name_b_a' => 'Case Coordinator', 'label_b_a' => 'Case Coordinator', 'description' => 'Case Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Homeless Services Coordinator is', 'label_a_b' => 'Homeless Services Coordinator is', 'name_b_a' => 'Homeless Services Coordinator', 'label_b_a' => 'Homeless Services Coordinator', 'description' => 'Homeless Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Health Services Coordinator is', 'label_a_b' => 'Health Services Coordinator is', 'name_b_a' => 'Health Services Coordinator', 'label_b_a' => 'Health Services Coordinator', 'description' => 'Health Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Senior Services Coordinator is', 'label_a_b' => 'Senior Services Coordinator is', 'name_b_a' => 'Senior Services Coordinator', 'label_b_a' => 'Senior Services Coordinator', 'description' => 'Senior Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Benefits Specialist is', 'label_a_b' => 'Benefits Specialist is', 'name_b_a' => 'Benefits Specialist', 'label_b_a' => 'Benefits Specialist', 'description' => 'Benefits Specialist', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
// enable the default custom templates for the case type xml files
$this->customDirectories(array('template_path' => TRUE));
// case is not enabled by default
$enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
$this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
$this->_params = array('case_type_id' => $this->caseTypeId, 'subject' => 'Test case', 'contact_id' => 17);
// create a logged in USER since the code references it for source_contact_id
$this->createLoggedInUser();
$session = CRM_Core_Session::singleton();
$this->_loggedInUser = $session->get('userID');
/// note that activityType options are cached by the FULL set of options you pass in
// ie. because Activity api includes campaign in it's call cache is not flushed unless
// included in this call. Also note flush function doesn't work on this property as it sets to null not empty array
CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
}
示例10: testSearch
/**
* Test CRM_Contact_BAO_Query::searchQuery()
* @dataProvider dataProvider
*/
function testSearch($fv, $count, $ids, $full)
{
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/queryDataset.xml'));
$params = CRM_Contact_BAO_Query::convertFormValues($fv);
$obj = new CRM_Contact_BAO_Query($params);
$obj->_useGroupBy = TRUE;
$dao = $obj->searchQuery();
$contacts = array();
while ($dao->fetch()) {
$contacts[] = $dao->contact_id;
}
sort($contacts, SORT_NUMERIC);
$this->assertEquals($ids, $contacts, 'In line ' . __LINE__);
}
示例11: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
parent::setUp();
// Insert a row in civicrm_group creating option group
// from_email_address group
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/group_admins.xml'));
// Insert a row in civicrm_group creating option group
// from_email_address group
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/group_subscribers.xml'));
// Insert a row in civicrm_group creating option group
// from_email_address group
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/group_nesting.xml'));
}
示例12: testSearch
/**
* Test CRM_Contact_BAO_Query::searchQuery()
* @dataProvider dataProvider
* @param $fv
* @param $count
* @param $ids
* @param $full
*/
public function testSearch($fv, $count, $ids, $full)
{
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/queryDataset.xml'));
$params = CRM_Contact_BAO_Query::convertFormValues($fv);
$obj = new CRM_Contact_BAO_Query($params);
// let's set useGroupBy=true since we are listing contacts here who might belong to
// more than one group / tag / notes etc.
$obj->_useGroupBy = TRUE;
$dao = $obj->searchQuery();
$contacts = array();
while ($dao->fetch()) {
$contacts[] = $dao->contact_id;
}
sort($contacts, SORT_NUMERIC);
$this->assertEquals($ids, $contacts);
}
示例13: setUp
public function setUp()
{
// Connect to the database
parent::setUp();
// Truncate the tables
$op = new PHPUnit_Extensions_Database_Operation_Truncate();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/../../CiviTest/truncate-option.xml'));
// Insert a row in civicrm_contact creating contact 17
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/contact_17.xml'));
// Insert a row in civicrm_option_group creating option group
// activity_type
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/dataset/option_group_activity_type.xml'));
// Insert a row in civicrm_option_value creating
// activity_type 5
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/option_value_activity_5.xml'));
// Insert rows in civicrm_activity creating activities 4 and
// 13
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/activity_4_13.xml'));
}
示例14: contributionTypeCreate
/**
* Function to create Contribution Type
*
* @return int $id of contribution type created
*/
function contributionTypeCreate()
{
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/../api/v2/dataset/contribution_types.xml'));
// FIXME: CHEATING LIKE HELL HERE, TO BE FIXED
return 1;
}
示例15: testReplaceContactFormatted
/**
* Test civicrm_replace_contact_formatted()
*/
public function testReplaceContactFormatted()
{
// Insert a row in civicrm_contact creating contact 17
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/contact_17.xml'));
$params = array('contact_type' => 'Individual', 'first_name' => 'Fred', 'last_name' => 'Figby');
$fields = array();
$result = civicrm_replace_contact_formatted(17, $params, $fields);
$this->assertTrue(is_array($result));
$this->assertEquals(0, $result['is_error'], "In line " . __LINE__ . " error message: " . $result['error_message']);
}