$orderByInner = $orderByOuter = "ORDER BY exactFirst";
if ($config->includeOrderByClause) {
- $orderByInner = "ORDER BY sort_name";
+ $orderByInner = "ORDER BY exactFirst, sort_name";
$orderByOuter .= ", sort_name";
}
/**
* Test that getquick returns contacts with an exact first name match first.
+ *
+ * Depending on the setting the sort name sort might click in next or not - test!
*/
public function testGetQuickFirstName() {
$this->getQuickSearchSampleData();
+ $this->callAPISuccess('Setting', 'create', array('includeOrderByClause' => TRUE));
$result = $this->callAPISuccess('contact', 'getquick', array(
'name' => 'Bob',
'field_name' => 'first_name',
$this->callAPISuccess('Setting', 'create', array('includeOrderByClause' => FALSE));
$result = $this->callAPISuccess('contact', 'getquick', array('name' => 'bob'));
$this->assertEquals('Bob, Bob', $result['values'][0]['sort_name']);
+ $this->assertEquals('A Bobby, Bobby', $result['values'][1]['sort_name']);
}
/**