mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 18:21:40 -04:00
test(CardDav): name all search data cases accurately
Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
parent
1e833cea34
commit
92cd85a28b
1 changed files with 82 additions and 0 deletions
|
|
@ -768,6 +768,88 @@ class CardDavBackendTest extends TestCase {
|
|||
$this->assertSame(count($expected), count($found));
|
||||
}
|
||||
|
||||
public static function dataTestSearch(): array {
|
||||
return [
|
||||
'basic FN search' => [
|
||||
'John',
|
||||
['FN'],
|
||||
[],
|
||||
[
|
||||
['uri0', 'John Doe'],
|
||||
['uri1', 'John M. Doe'],
|
||||
],
|
||||
],
|
||||
'partial FN match' => [
|
||||
'M. Doe',
|
||||
['FN'],
|
||||
[],
|
||||
[
|
||||
['uri1', 'John M. Doe'],
|
||||
],
|
||||
],
|
||||
'substring FN match' => [
|
||||
'Do',
|
||||
['FN'],
|
||||
[],
|
||||
[
|
||||
['uri0', 'John Doe'],
|
||||
['uri1', 'John M. Doe'],
|
||||
],
|
||||
],
|
||||
'duplicate matches across FN and CLOUD return one result per card' => [
|
||||
'John',
|
||||
['FN', 'CLOUD'],
|
||||
[],
|
||||
[
|
||||
['uri0', 'John Doe'],
|
||||
['uri1', 'John M. Doe'],
|
||||
],
|
||||
],
|
||||
'case-insensitive search' => [
|
||||
'john',
|
||||
['FN'],
|
||||
[],
|
||||
[
|
||||
['uri0', 'John Doe'],
|
||||
['uri1', 'John M. Doe'],
|
||||
],
|
||||
],
|
||||
'limit 1 returns first matching card' => [
|
||||
'john',
|
||||
['FN'],
|
||||
['limit' => 1],
|
||||
[
|
||||
['uri0', 'John Doe'],
|
||||
],
|
||||
],
|
||||
'limit 1 with offset 1 returns second matching card' => [
|
||||
'john',
|
||||
['FN'],
|
||||
['limit' => 1, 'offset' => 1],
|
||||
[
|
||||
['uri1', 'John M. Doe'],
|
||||
],
|
||||
],
|
||||
'underscore is escaped by default in CLOUD search' => [
|
||||
'_',
|
||||
['CLOUD'],
|
||||
[],
|
||||
[
|
||||
['uri2', 'find without options'],
|
||||
],
|
||||
],
|
||||
'wildcards are honored when escape_like_param is false' => [
|
||||
'%_%',
|
||||
['CLOUD'],
|
||||
['escape_like_param' => false],
|
||||
[
|
||||
['uri0', 'John Doe'],
|
||||
['uri2', 'find without options'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public static function dataTestSearch(): array {
|
||||
return [
|
||||
['John', ['FN'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
|
|
|
|||
Loading…
Reference in a new issue