From b25fe59afa796c3f7ca85037b73949aea5429bbc Mon Sep 17 00:00:00 2001 From: Eileen Date: Fri, 8 Nov 2013 17:09:38 +1300 Subject: [PATCH] CRM-13707 api test generated examples - fix escaping in output ---------------------------------------- * CRM-13707: api\v3\examples\SettingGetFields has syntax errors, due unescaped ' http://issues.civicrm.org/jira/browse/CRM-13707 --- api/v3/examples/SettingGetfields.php | 86 ++++++++++++++++----- tests/phpunit/CiviTest/CiviUnitTestCase.php | 4 + 2 files changed, 71 insertions(+), 19 deletions(-) diff --git a/api/v3/examples/SettingGetfields.php b/api/v3/examples/SettingGetfields.php index 0fc2752ad6..bdbf056954 100644 --- a/api/v3/examples/SettingGetfields.php +++ b/api/v3/examples/SettingGetfields.php @@ -28,7 +28,7 @@ function setting_getfields_expectedresult(){ $expectedResult = array( 'is_error' => 0, 'version' => 3, - 'count' => 78, + 'count' => 81, 'values' => array( 'address_standardization_provider' => array( 'group_name' => 'Address Preferences', @@ -513,7 +513,7 @@ function setting_getfields_expectedresult(){ 'title' => 'New Version Alerts', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Displays an on-screen alert to users with "Administer CiviCRM" permissions when a new version of CiviCRM is available. This setting will only work if the "Version Check & Statistics Reporting" setting is enabled.', + 'description' => 'Displays an on-screen alert to users with \"Administer CiviCRM\" permissions when a new version of CiviCRM is available. This setting will only work if the \"Version Check & Statistics Reporting\" setting is enabled.', 'help_text' => '', ), 'versionCheck' => array( @@ -673,7 +673,7 @@ When enabled, statistics about your CiviCRM installation are reported anonymousl 'is_domain' => 1, 'is_contact' => 0, 'description' => 'Service providing CiviCRM community messages', - 'help_text' => 'Use "*default*" for the system default or override with a custom URL', + 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', ), 'resCacheCode' => array( 'group_name' => 'CiviCRM Preferences', @@ -739,7 +739,7 @@ When enabled, statistics about your CiviCRM installation are reported anonymousl 'title' => 'Allow second-degree relationship permissions', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If enabled, contacts with the permission to edit a related contact will inherit that contact's permission to edit other related contacts', + 'description' => 'If enabled, contacts with the permission to edit a related contact will inherit that contact\'s permission to edit other related contacts', 'help_text' => '', ), 'enable_components' => array( @@ -769,6 +769,20 @@ When enabled, statistics about your CiviCRM installation are reported anonymousl 'description' => '', 'help_text' => '', ), + 'disable_core_css' => array( + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'disable_core_css', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.4', + 'title' => 'Disable CiviCRM css', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Prevent the stylesheet \"civicrm.css\" from being loaded.', + 'help_text' => '', + ), 'debug_enabled' => array( 'group_name' => 'Developer Preferences', 'group' => 'developer', @@ -782,7 +796,7 @@ When enabled, statistics about your CiviCRM installation are reported anonymousl 'title' => 'Enable Debugging', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Set this value to Yes if you want to use one of CiviCRM's debugging tools. This feature should NOT be enabled for production sites', + 'description' => 'Set this value to Yes if you want to use one of CiviCRM\'s debugging tools. This feature should NOT be enabled for production sites', 'prefetch' => 1, 'help_text' => 'Do not turn this on on production sites', ), @@ -800,8 +814,8 @@ When enabled, statistics about your CiviCRM installation are reported anonymousl 'is_contact' => 0, 'description' => 'Set this value to Yes if you want CiviCRM error/debugging messages to also appear in Drupal error logs', 'prefetch' => 1, - 'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS' error log. -In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal's watchdog enabled)', + 'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS\' error log. +In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal\'s watchdog enabled)', ), 'backtrace' => array( 'group_name' => 'Developer Preferences', @@ -1046,6 +1060,26 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'description' => 'Default currency assigned to contributions and other monetary transactions.', 'help_text' => '', ), + 'defaultContactCountry' => array( + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'defaultContactCountry', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 4, + ), + 'default' => '1228', + 'add' => '4.4', + 'title' => 'Default Country', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'This value is selected by default when adding a new contact address.', + 'help_text' => '', + ), 'countryLimit' => array( 'group_name' => 'Localization Preferences', 'group' => 'localization', @@ -1177,7 +1211,7 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'title' => 'Enable Double Opt-in for Profile Group(s) field', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', ), 'track_civimail_replies' => array( @@ -1191,7 +1225,7 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'title' => 'Enable Double Opt-in for Profile Group(s) field', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', 'validate_callback' => 'CRM_Core_BAO_Setting::validateBoolSetting', ), @@ -1206,7 +1240,7 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'title' => '', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', ), 'civimail_server_wide_lock' => array( @@ -1248,7 +1282,21 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'title' => 'Enable Double Opt-in for Profile Group(s) field', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'help_text' => '', + ), + 'disable_mandatory_tokens_check' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'disable_mandatory_tokens_check', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.4', + 'title' => 'Disable check for mandatory tokens', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.', 'help_text' => '', ), 'default_renewal_contribution_page' => array( @@ -1265,7 +1313,7 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'title' => 'Default online membership renewal page', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If you select a default online contribution page for self-service membership renewals, a "renew" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships.', + 'description' => 'If you select a default online contribution page for self-service membership renewals, a \"renew\" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships.', 'help_text' => '', ), 'is_enabled' => array( @@ -1337,8 +1385,8 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'help_text' => '', ), 'userFrameworkResourceURL' => array( - 'group' => 'UrlPreferences', - 'group_name' => 'url', + 'group' => 'url', + 'group_name' => 'URL Preferences', 'name' => 'userFrameworkResourceURL', 'type' => 'String', 'default' => '', @@ -1351,8 +1399,8 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'validate_callback' => 'CRM_Utils_Rule::url', ), 'imageUploadURL' => array( - 'group' => 'UrlPreferences', - 'group_name' => 'url', + 'group' => 'url', + 'group_name' => 'URL Preferences', 'name' => 'imageUploadURL', 'type' => 'String', 'default' => '', @@ -1365,8 +1413,8 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t 'validate_callback' => 'CRM_Utils_Rule::url', ), 'customCSSURL' => array( - 'group' => 'UrlPreferences', - 'group_name' => 'url', + 'group' => 'url', + 'group_name' => 'URL Preferences', 'name' => 'customCSSURL', 'type' => 'String', 'default' => '', @@ -1405,4 +1453,4 @@ In the case of Drupal, this will cause all CiviCRM error messages to appear in t * * API Standards documentation: * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards -*/ \ No newline at end of file +*/ diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index bbd4d12ae2..0c83a0cb2d 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -1987,10 +1987,14 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { } if(in_array($key, $keysToUnset)) { unset($values[$key]); + break; } if(array_key_exists($key, $fieldsToChange) && !empty($value)) { $value = $fieldsToChange[$key]; } + if(is_string($value)) { + $value = addslashes($value); + } } } } -- 2.25.1