Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
61ae8e8b
Commit
61ae8e8b
authored
May 13, 2011
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 656994: Test custom search more thoroughly in xt/search.t.
r=mkanat, a=mkanat (module owner)
parent
c3a93557
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
6 deletions
+135
-6
Constants.pm
xt/lib/Bugzilla/Test/Search/Constants.pm
+132
-3
CustomTest.pm
xt/lib/Bugzilla/Test/Search/CustomTest.pm
+3
-3
No files found.
xt/lib/Bugzilla/Test/Search/Constants.pm
View file @
61ae8e8b
...
...
@@ -1023,13 +1023,142 @@ use constant SPECIAL_PARAM_TESTS => (
);
use
constant
CUSTOM_SEARCH_TESTS
=>
(
{
name
=>
'bug_id AND assigned_to'
,
contains
=>
[
1
],
{
name
=>
'OP without CP'
,
contains
=>
[
1
],
params
=>
[
{
f
=>
'OP'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
]
},
{
name
=>
'Empty OP/CP pair before criteria'
,
contains
=>
[
1
],
params
=>
[
{
f
=>
'OP'
},
{
f
=>
'CP'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
]
},
{
name
=>
'Empty OP/CP pair after criteria'
,
contains
=>
[
1
],
params
=>
[
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'OP'
},
{
f
=>
'CP'
},
]
},
{
name
=>
'empty OP/CP mid criteria'
,
contains
=>
[
1
],
columns
=>
[
'assigned_to'
],
params
=>
[
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'OP'
},
{
f
=>
'CP'
},
{
f
=>
'assigned_to'
,
o
=>
'substr'
,
v
=>
'@'
},
]
},
{
name
=>
'bug_id = 1 AND assigned_to contains @'
,
contains
=>
[
1
],
columns
=>
[
'assigned_to'
],
params
=>
[
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'substr'
,
v
=>
'@'
},
]
},
{
name
=>
'NOT(bug_id = 1) AND NOT(assigned_to = 2)'
,
contains
=>
[
3
,
4
,
5
],
columns
=>
[
'assigned_to'
],
params
=>
[
{
n
=>
1
,
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
n
=>
1
,
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<2>'
},
]
},
{
name
=>
'bug_id = 1 OR assigned_to = 2'
,
contains
=>
[
1
,
2
],
columns
=>
[
'assigned_to'
],
top_params
=>
{
j_top
=>
'OR'
},
params
=>
[
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<2>'
},
]
},
{
name
=>
'NOT(bug_id = 1 AND assigned_to = 1)'
,
contains
=>
[
2
,
3
,
4
,
5
],
columns
=>
[
'assigned_to'
],
params
=>
[
{
f
=>
'OP'
,
n
=>
1
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'CP'
},
]
},
{
name
=>
'(bug_id = 1 AND assigned_to contains @) '
.
' OR (bug_id = 2 AND assigned_to contains @)'
,
contains
=>
[
1
,
2
],
columns
=>
[
'assigned_to'
],
top_params
=>
{
j_top
=>
'OR'
},
params
=>
[
{
f
=>
'OP'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'substr'
,
v
=>
'@'
},
{
f
=>
'CP'
},
{
f
=>
'OP'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<2>'
},
{
f
=>
'assigned_to'
,
o
=>
'substr'
,
v
=>
'@'
},
{
f
=>
'CP'
},
]
},
{
name
=>
'(bug_id = 1 OR assigned_to = 2) '
.
' AND (bug_id = 2 OR assigned_to = 1)'
,
contains
=>
[
1
,
2
],
columns
=>
[
'assigned_to'
],
params
=>
[
{
f
=>
'OP'
,
j
=>
'OR'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<2>'
},
{
f
=>
'CP'
},
{
f
=>
'OP'
,
j
=>
'OR'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<2>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'CP'
},
]
},
{
name
=>
'bug_id = 3 OR ( (bug_id = 1 OR assigned_to = 2) '
.
' AND (bug_id = 2 OR assigned_to = 1) )'
,
contains
=>
[
1
,
2
,
3
],
columns
=>
[
'assigned_to'
],
top_params
=>
{
j_top
=>
'OR'
},
params
=>
[
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<3>'
},
{
f
=>
'OP'
},
{
f
=>
'OP'
,
j
=>
'OR'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<2>'
},
{
f
=>
'CP'
},
{
f
=>
'OP'
,
j
=>
'OR'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<2>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'CP'
},
{
f
=>
'CP'
},
]
},
{
name
=>
'bug_id = 3 OR ( (bug_id = 1 OR assigned_to = 2) '
.
' AND (bug_id = 2 OR assigned_to = 1) ) OR bug_id = 4'
,
contains
=>
[
1
,
2
,
3
,
4
],
columns
=>
[
'assigned_to'
],
top_params
=>
{
j_top
=>
'OR'
},
params
=>
[
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<3>'
},
{
f
=>
'OP'
},
{
f
=>
'OP'
,
j
=>
'OR'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<2>'
},
{
f
=>
'CP'
},
{
f
=>
'OP'
,
j
=>
'OR'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<2>'
},
{
f
=>
'assigned_to'
,
o
=>
'equals'
,
v
=>
'<1>'
},
{
f
=>
'CP'
},
{
f
=>
'CP'
},
{
f
=>
'bug_id'
,
o
=>
'equals'
,
v
=>
'<4>'
},
]
},
);
1
;
xt/lib/Bugzilla/Test/Search/CustomTest.pm
View file @
61ae8e8b
...
...
@@ -80,10 +80,10 @@ sub invalid_field_operator_combination { return undef }
sub
search_params
{
my
(
$self
)
=
@_
;
my
%
params
;
my
%
params
=
%
{
$self
->
test
->
{
top_params
}
||
{}
}
;
my
$counter
=
0
;
foreach
my
$row
(
@
{
$self
->
test
->
{
params
}
})
{
$row
->
{
v
}
=
$self
->
translate_value
(
$row
);
$row
->
{
v
}
=
$self
->
translate_value
(
$row
)
if
exists
$row
->
{
v
}
;
foreach
my
$key
(
keys
%
$row
)
{
$params
{
"${key}$counter"
}
=
$row
->
{
$key
};
}
...
...
@@ -107,7 +107,7 @@ sub translate_value {
sub
search_columns
{
my
(
$self
)
=
@_
;
return
[
'bug_id'
,
@
{
$self
->
test
->
{
columns
}
}];
return
[
'bug_id'
,
@
{
$self
->
test
->
{
columns
}
||
[]
}];
}
1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment