// May or may not cleanup well if there's a bug in the indexer.
// This is better than nothing -- and better than duplicating the
// cleanup logic.
- $idx = new CRM_Core_InnoDBIndexer(FALSE, array());
+ $idx = new CRM_Core_InnoDBIndexer(FALSE, []);
$idx->fixSchemaDifferences();
parent::tearDown();
}
public function testHasDeclaredIndex() {
- $idx = new CRM_Core_InnoDBIndexer(TRUE, array(
- 'civicrm_contact' => array(
- array('first_name', 'last_name'),
- array('foo'),
- ),
- 'civicrm_email' => array(
- array('whiz'),
- ),
- ));
+ $idx = new CRM_Core_InnoDBIndexer(TRUE, [
+ 'civicrm_contact' => [
+ ['first_name', 'last_name'],
+ ['foo'],
+ ],
+ 'civicrm_email' => [
+ ['whiz'],
+ ],
+ ]);
- $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', array('first_name', 'last_name')));
- $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', array('last_name', 'first_name')));
+ $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', ['first_name', 'last_name']));
+ $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', ['last_name', 'first_name']));
// not sure if this is right behavior
- $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', array('first_name')));
+ $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', ['first_name']));
// not sure if this is right behavior
- $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', array('last_name')));
- $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', array('foo')));
- $this->assertFalse($idx->hasDeclaredIndex('civicrm_contact', array('whiz')));
+ $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', ['last_name']));
+ $this->assertTrue($idx->hasDeclaredIndex('civicrm_contact', ['foo']));
+ $this->assertFalse($idx->hasDeclaredIndex('civicrm_contact', ['whiz']));
- $this->assertFalse($idx->hasDeclaredIndex('civicrm_email', array('first_name', 'last_name')));
- $this->assertFalse($idx->hasDeclaredIndex('civicrm_email', array('foo')));
- $this->assertTrue($idx->hasDeclaredIndex('civicrm_email', array('whiz')));
+ $this->assertFalse($idx->hasDeclaredIndex('civicrm_email', ['first_name', 'last_name']));
+ $this->assertFalse($idx->hasDeclaredIndex('civicrm_email', ['foo']));
+ $this->assertTrue($idx->hasDeclaredIndex('civicrm_email', ['whiz']));
}
/**
* When disabled, there is no FTS index, so queries that rely on FTS index fail.
*/
public function testDisabled() {
- $idx = new CRM_Core_InnoDBIndexer(FALSE, array(
- 'civicrm_contact' => array(
- array('first_name', 'last_name'),
- ),
- ));
+ $idx = new CRM_Core_InnoDBIndexer(FALSE, [
+ 'civicrm_contact' => [
+ ['first_name', 'last_name'],
+ ],
+ ]);
$idx->fixSchemaDifferences();
try {
return;
}
- $idx = new CRM_Core_InnoDBIndexer(TRUE, array(
- 'civicrm_contact' => array(
- array('first_name', 'last_name'),
- ),
- ));
+ $idx = new CRM_Core_InnoDBIndexer(TRUE, [
+ 'civicrm_contact' => [
+ ['first_name', 'last_name'],
+ ],
+ ]);
$idx->fixSchemaDifferences();
CRM_Core_DAO::executeQuery('SELECT id FROM civicrm_contact WHERE MATCH(first_name,last_name) AGAINST ("joe")');