'defaultSearchProfileID' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
'smartGroupCacheTimeout' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
'quicksearch_options' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
- 'contact_autocomplete_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'contact_reference_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'search_autocomplete_count' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
- 'enable_innodb_fts' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
- 'default_pager_size' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME,
];
/**
editor_id
enableSSL
enable_cart
-enable_innodb_fts
-fts_query_mode
includeAlphabeticalPager
includeEmailInName
includeNickNameInName
],
],
],
- 'fts_query_mode' => [
- 'group_name' => 'Search Preferences',
- 'group' => 'Search Preferences',
- 'name' => 'fts_query_mode',
- 'type' => 'String',
- 'quick_form_type' => 'Element',
- 'html_attributes' => [
- 'size' => 64,
- 'maxlength' => 64,
- ],
- 'html_type' => 'text',
- 'default' => 'simple',
- 'add' => '4.5',
- 'title' => 'How to handle full-text queries',
- 'is_domain' => 1,
- 'is_contact' => 0,
- 'help_text' => '',
- ],
'includeOrderByClause' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
<mixin>menu-xml@1.0.0</mixin>
<mixin>mgd-php@1.0.0</mixin>
<mixin>smarty-v2@1.0.0</mixin>
+ <mixin>setting-php@1.0.0</mixin>
</mixins>
<civix>
<namespace>CRM/Legacycustomsearches</namespace>
--- /dev/null
+<?php
+return [
+ 'enable_innodb_fts' => [
+ 'group_name' => 'Search Preferences',
+ 'group' => 'Search Preferences',
+ 'name' => 'enable_innodb_fts',
+ 'type' => 'Boolean',
+ 'quick_form_type' => 'YesNo',
+ 'default' => 0,
+ 'add' => '4.4',
+ 'title' => ts('InnoDB Full Text Search'),
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => ts('Enable InnoDB full-text search optimizations. (Requires MySQL 5.6+)'),
+ 'help_text' => NULL,
+ 'on_change' => [
+ ['CRM_Core_InnoDBIndexer', 'onToggleFts'],
+ ],
+ 'settings_pages' => ['search' => ['weight' => 100]],
+ ],
+ 'fts_query_mode' => [
+ 'group_name' => 'Search Preferences',
+ 'group' => 'Search Preferences',
+ 'name' => 'fts_query_mode',
+ 'type' => 'String',
+ 'quick_form_type' => 'Element',
+ 'html_attributes' => [
+ 'size' => 64,
+ 'maxlength' => 64,
+ ],
+ 'html_type' => 'text',
+ 'default' => 'simple',
+ 'add' => '4.5',
+ 'title' => ts('How to handle full-text queries'),
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'help_text' => NULL,
+ ],
+];
<?php
+use Civi\Test;
+use Civi\Test\HeadlessInterface;
+use Civi\Test\HookInterface;
+use PHPUnit\Framework\TestCase;
+
/**
* Class CRM_Core_InnoDBIndexerTest
* @group headless
*/
-class CRM_Core_InnoDBIndexerTest extends CiviUnitTestCase {
+class CRM_Core_InnoDBIndexerTest extends TestCase implements HeadlessInterface, HookInterface {
+
+ /**
+ * Civi\Test has many helpers, like install(), uninstall(), sql(), and
+ * sqlFile(). See:
+ * https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md
+ */
+ public function setUpHeadless(): Test\CiviEnvBuilder {
+ return Test::headless()
+ ->install(['legacycustomsearches'])
+ ->apply();
+ }
/**
* Indices to be created or removed.
/**
* When enabled, the FTS index is created, so queries that rely on FTS work.
+ *
+ * @throws \Civi\Core\Exception\DBQueryException
*/
public function testEnabled(): void {
$this->indices = [
<?php
+use Civi\Test;
+use Civi\Test\HeadlessInterface;
+use Civi\Test\HookInterface;
+use PHPUnit\Framework\TestCase;
+
/**
- * Class CRM_Utils_QueryFormatterTest
+ * FIXME - Add test description.
+ *
+ * Tips:
+ * - With HookInterface, you may implement CiviCRM hooks directly in the test
+ * class. Simply create corresponding functions (e.g. "hook_civicrm_post(...)"
+ * or similar).
+ * - With TransactionalInterface, any data changes made by setUp() or
+ * test****() functions will rollback automatically -- as long as you don't
+ * manipulate schema or truncate tables. If this test needs to manipulate
+ * schema or truncate tables, then either: a. Do all that using setupHeadless()
+ * and Civi\Test. b. Disable TransactionalInterface, and handle all
+ * setup/teardown yourself.
+ *
* @group headless
*/
-class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase {
+class CRM_Utils_QueryFormatterTest extends TestCase implements HeadlessInterface, HookInterface {
+
+ /**
+ * Civi\Test has many helpers, like install(), uninstall(), sql(), and
+ * sqlFile(). See:
+ * https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md
+ */
+ public function setUpHeadless(): Test\CiviEnvBuilder {
+ return Test::headless()
+ ->install(['legacycustomsearches'])
+ ->apply();
+ }
public function createExampleTable() {
CRM_Core_DAO::executeQuery('
[9, 'firstly someone'],
];
foreach ($rows as $row) {
- CRM_Core_DAO::executeQuery("INSERT INTO civicrm_fts_example (id,name) VALUES (%1, %2)",
+ CRM_Core_DAO::executeQuery('INSERT INTO civicrm_fts_example (id,name) VALUES (%1, %2)',
[
1 => [$row[0], 'Int'],
2 => [$row[1], 'String'],
'help_text' => NULL,
'serialize' => CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND,
'validate_callback' => 'CRM_Admin_Form_Setting_Search::enableOptionOne',
+ 'settings_pages' => ['search' => ['weight' => 80]],
],
'contact_reference_options' => [
'group_name' => 'CiviCRM Preferences',
'help_text' => NULL,
'serialize' => CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND,
'validate_callback' => 'CRM_Admin_Form_Setting_Search::enableOptionOne',
+ 'settings_pages' => ['search' => ['weight' => 90]],
],
'contact_smart_group_display' => [
'group_name' => 'CiviCRM Preferences',
'description' => ts('The maximum number of contacts to show at a time when typing in an autocomplete field.'),
'help_text' => NULL,
],
- 'enable_innodb_fts' => [
- 'group_name' => 'Search Preferences',
- 'group' => 'Search Preferences',
- 'name' => 'enable_innodb_fts',
- 'type' => 'Boolean',
- 'quick_form_type' => 'YesNo',
- 'default' => 0,
- 'add' => '4.4',
- 'title' => ts('InnoDB Full Text Search'),
- 'is_domain' => 1,
- 'is_contact' => 0,
- 'description' => ts('Enable InnoDB full-text search optimizations. (Requires MySQL 5.6+)'),
- 'help_text' => NULL,
- 'on_change' => [
- ['CRM_Core_InnoDBIndexer', 'onToggleFts'],
- ],
- ],
- 'fts_query_mode' => [
- 'group_name' => 'Search Preferences',
- 'group' => 'Search Preferences',
- 'name' => 'fts_query_mode',
- 'type' => 'String',
- 'quick_form_type' => 'Element',
- 'html_attributes' => [
- 'size' => 64,
- 'maxlength' => 64,
- ],
- 'html_type' => 'text',
- 'default' => 'simple',
- 'add' => '4.5',
- 'title' => ts('How to handle full-text queries'),
- 'is_domain' => 1,
- 'is_contact' => 0,
- 'help_text' => NULL,
- ],
'includeOrderByClause' => [
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'is_contact' => 0,
'description' => ts('What is the default number of records to show on a search'),
'help_text' => NULL,
+ 'settings_pages' => ['search' => ['weight' => 120]],
],
];